"""add_pharmacy_table

Revision ID: 4de5c8a43c0e
Revises: f2eef408dabf
Create Date: 2025-06-21 10:07:52.506806

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4de5c8a43c0e'
down_revision = 'f2eef408dabf'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('pharmacies',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('address', sa.String(), nullable=False),
    sa.Column('phone_number', sa.String(), nullable=True),
    sa.Column('email', sa.String(), nullable=True),
    sa.Column('website', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('medications', sa.Column('pharmacy_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'medications', 'pharmacies', ['pharmacy_id'], ['id'])
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'medications', type_='foreignkey')
    op.drop_column('medications', 'pharmacy_id')
    op.drop_table('pharmacies')
    # ### end Alembic commands ###
