"""corrected pharmacy feature types

Revision ID: b499032f9b2b
Revises: 78e6a9f0c46d
Create Date: 2025-06-21 14:44:25.405761

"""
from alembic import op


# revision identifiers, used by Alembic.
revision = 'b499032f9b2b'
down_revision = '78e6a9f0c46d'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # Convert string values to boolean using USING clause
    op.execute("ALTER TABLE pharmacies ALTER COLUMN drive_through TYPE BOOLEAN USING (drive_through = 'true')")
    op.execute("ALTER TABLE pharmacies ALTER COLUMN twenty_four_hour TYPE BOOLEAN USING (twenty_four_hour = 'true')")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    # Convert boolean values back to string
    op.execute("ALTER TABLE pharmacies ALTER COLUMN twenty_four_hour TYPE VARCHAR USING (CASE WHEN twenty_four_hour THEN 'true' ELSE 'false' END)")
    op.execute("ALTER TABLE pharmacies ALTER COLUMN drive_through TYPE VARCHAR USING (CASE WHEN drive_through THEN 'true' ELSE 'false' END)")
    # ### end Alembic commands ###
