"""new_changes

Revision ID: 8c11049a3130
Revises: 6d9bfb8d69ac
Create Date: 2019-10-30 21:41:13.192044

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

# revision identifiers, used by Alembic.
revision = '8c11049a3130'
down_revision = '6d9bfb8d69ac'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('physician_schedule',
    sa.Column('event_id', sa.Integer(), nullable=False),
    sa.Column('physician_id', sa.Integer(), nullable=False),
    sa.Column('start_time', sa.DateTime(), nullable=False),
    sa.Column('end_time', sa.DateTime(), nullable=False),
    sa.Column('event_type', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['physician_id'], ['physician.user_id'], ),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.add_column('appointment', sa.Column('event_id', sa.Integer(), nullable=False))
    op.add_column('appointment', sa.Column('facility_num', sa.String(length=64), nullable=False))
    op.drop_constraint('appointment_ibfk_2', 'appointment', type_='foreignkey')
    op.create_foreign_key(None, 'appointment', 'facility', ['facility_num'], ['facility_num'])
    op.create_foreign_key(None, 'appointment', 'physician_schedule', ['event_id'], ['event_id'])
    op.drop_column('appointment', 'physician_id')
    op.drop_column('appointment', 'start_time')
    op.drop_column('appointment', 'end_time')
    op.add_column('patient', sa.Column('SSN', sa.String(length=128), nullable=True))
    op.drop_column('patient', 'SSN_hash')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(), nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(), nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician', ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')
    # ### end Alembic commands ###

3829d14d87d88081ba1dc889d9502a6719610335
<mask token>


def downgrade():
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128
        ), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(
        display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician',
        ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')

<mask token>


def upgrade():
    op.create_table('physician_schedule', sa.Column('event_id', sa.Integer(
        ), nullable=False), sa.Column('physician_id', sa.Integer(),
        nullable=False), sa.Column('start_time', sa.DateTime(), nullable=
        False), sa.Column('end_time', sa.DateTime(), nullable=False), sa.
        Column('event_type', sa.String(length=64), nullable=False), sa.
        ForeignKeyConstraint(['physician_id'], ['physician.user_id']), sa.
        PrimaryKeyConstraint('event_id'))
    op.add_column('appointment', sa.Column('event_id', sa.Integer(),
        nullable=False))
    op.add_column('appointment', sa.Column('facility_num', sa.String(length
        =64), nullable=False))
    op.drop_constraint('appointment_ibfk_2', 'appointment', type_='foreignkey')
    op.create_foreign_key(None, 'appointment', 'facility', ['facility_num'],
        ['facility_num'])
    op.create_foreign_key(None, 'appointment', 'physician_schedule', [
        'event_id'], ['event_id'])
    op.drop_column('appointment', 'physician_id')
    op.drop_column('appointment', 'start_time')
    op.drop_column('appointment', 'end_time')
    op.add_column('patient', sa.Column('SSN', sa.String(length=128),
        nullable=True))
    op.drop_column('patient', 'SSN_hash')


def downgrade():
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128
        ), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(
        display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician',
        ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')

<mask token>
revision = '8c11049a3130'
down_revision = '6d9bfb8d69ac'
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('physician_schedule', sa.Column('event_id', sa.Integer(
        ), nullable=False), sa.Column('physician_id', sa.Integer(),
        nullable=False), sa.Column('start_time', sa.DateTime(), nullable=
        False), sa.Column('end_time', sa.DateTime(), nullable=False), sa.
        Column('event_type', sa.String(length=64), nullable=False), sa.
        ForeignKeyConstraint(['physician_id'], ['physician.user_id']), sa.
        PrimaryKeyConstraint('event_id'))
    op.add_column('appointment', sa.Column('event_id', sa.Integer(),
        nullable=False))
    op.add_column('appointment', sa.Column('facility_num', sa.String(length
        =64), nullable=False))
    op.drop_constraint('appointment_ibfk_2', 'appointment', type_='foreignkey')
    op.create_foreign_key(None, 'appointment', 'facility', ['facility_num'],
        ['facility_num'])
    op.create_foreign_key(None, 'appointment', 'physician_schedule', [
        'event_id'], ['event_id'])
    op.drop_column('appointment', 'physician_id')
    op.drop_column('appointment', 'start_time')
    op.drop_column('appointment', 'end_time')
    op.add_column('patient', sa.Column('SSN', sa.String(length=128),
        nullable=True))
    op.drop_column('patient', 'SSN_hash')


def downgrade():
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128
        ), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(
        display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician',
        ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')

<mask token>
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
revision = '8c11049a3130'
down_revision = '6d9bfb8d69ac'
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('physician_schedule', sa.Column('event_id', sa.Integer(
        ), nullable=False), sa.Column('physician_id', sa.Integer(),
        nullable=False), sa.Column('start_time', sa.DateTime(), nullable=
        False), sa.Column('end_time', sa.DateTime(), nullable=False), sa.
        Column('event_type', sa.String(length=64), nullable=False), sa.
        ForeignKeyConstraint(['physician_id'], ['physician.user_id']), sa.
        PrimaryKeyConstraint('event_id'))
    op.add_column('appointment', sa.Column('event_id', sa.Integer(),
        nullable=False))
    op.add_column('appointment', sa.Column('facility_num', sa.String(length
        =64), nullable=False))
    op.drop_constraint('appointment_ibfk_2', 'appointment', type_='foreignkey')
    op.create_foreign_key(None, 'appointment', 'facility', ['facility_num'],
        ['facility_num'])
    op.create_foreign_key(None, 'appointment', 'physician_schedule', [
        'event_id'], ['event_id'])
    op.drop_column('appointment', 'physician_id')
    op.drop_column('appointment', 'start_time')
    op.drop_column('appointment', 'end_time')
    op.add_column('patient', sa.Column('SSN', sa.String(length=128),
        nullable=True))
    op.drop_column('patient', 'SSN_hash')


def downgrade():
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128
        ), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(),
        nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(
        display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician',
        ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')

"""new_changes

Revision ID: 8c11049a3130
Revises: 6d9bfb8d69ac
Create Date: 2019-10-30 21:41:13.192044

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

# revision identifiers, used by Alembic.
revision = '8c11049a3130'
down_revision = '6d9bfb8d69ac'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('physician_schedule',
    sa.Column('event_id', sa.Integer(), nullable=False),
    sa.Column('physician_id', sa.Integer(), nullable=False),
    sa.Column('start_time', sa.DateTime(), nullable=False),
    sa.Column('end_time', sa.DateTime(), nullable=False),
    sa.Column('event_type', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['physician_id'], ['physician.user_id'], ),
    sa.PrimaryKeyConstraint('event_id')
    )
    op.add_column('appointment', sa.Column('event_id', sa.Integer(), nullable=False))
    op.add_column('appointment', sa.Column('facility_num', sa.String(length=64), nullable=False))
    op.drop_constraint('appointment_ibfk_2', 'appointment', type_='foreignkey')
    op.create_foreign_key(None, 'appointment', 'facility', ['facility_num'], ['facility_num'])
    op.create_foreign_key(None, 'appointment', 'physician_schedule', ['event_id'], ['event_id'])
    op.drop_column('appointment', 'physician_id')
    op.drop_column('appointment', 'start_time')
    op.drop_column('appointment', 'end_time')
    op.add_column('patient', sa.Column('SSN', sa.String(length=128), nullable=True))
    op.drop_column('patient', 'SSN_hash')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('patient', sa.Column('SSN_hash', mysql.VARCHAR(length=128), nullable=True))
    op.drop_column('patient', 'SSN')
    op.add_column('appointment', sa.Column('end_time', mysql.DATETIME(), nullable=False))
    op.add_column('appointment', sa.Column('start_time', mysql.DATETIME(), nullable=False))
    op.add_column('appointment', sa.Column('physician_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.drop_constraint(None, 'appointment', type_='foreignkey')
    op.create_foreign_key('appointment_ibfk_2', 'appointment', 'physician', ['physician_id'], ['user_id'])
    op.drop_column('appointment', 'facility_num')
    op.drop_column('appointment', 'event_id')
    op.drop_table('physician_schedule')
    # ### end Alembic commands ###
