"""empty message

Revision ID: b5e8b9ce3d51
Revises: ef7c3148cfcb
Create Date: 2023-02-28 11:25:27.910837

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'b5e8b9ce3d51'
down_revision = 'ef7c3148cfcb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('doctors', schema=None) as batch_op:
        batch_op.add_column(sa.Column('img_name', sa.String(length=50), nullable=True))
        batch_op.add_column(sa.Column('img_data', sa.LargeBinary(), nullable=True))

    with op.batch_alter_table('patients', schema=None) as batch_op:
        batch_op.add_column(sa.Column('img_name', sa.String(length=50), nullable=True))
        batch_op.add_column(sa.Column('img_data', sa.LargeBinary(), nullable=True))
        batch_op.alter_column('first_name',
               existing_type=mysql.VARCHAR(length=30),
               type_=sa.String(length=50),
               existing_nullable=False)
        batch_op.alter_column('last_name',
               existing_type=mysql.VARCHAR(length=30),
               type_=sa.String(length=50),
               existing_nullable=False)
        batch_op.alter_column('email',
               existing_type=mysql.VARCHAR(length=30),
               type_=sa.String(length=50),
               existing_nullable=True)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('patients', schema=None) as batch_op:
        batch_op.alter_column('email',
               existing_type=sa.String(length=50),
               type_=mysql.VARCHAR(length=30),
               existing_nullable=True)
        batch_op.alter_column('last_name',
               existing_type=sa.String(length=50),
               type_=mysql.VARCHAR(length=30),
               existing_nullable=False)
        batch_op.alter_column('first_name',
               existing_type=sa.String(length=50),
               type_=mysql.VARCHAR(length=30),
               existing_nullable=False)
        batch_op.drop_column('img_data')
        batch_op.drop_column('img_name')

    with op.batch_alter_table('doctors', schema=None) as batch_op:
        batch_op.drop_column('img_data')
        batch_op.drop_column('img_name')

    # ### end Alembic commands ###
