"""db relationships upgrade

Revision ID: 90bdca2461e4
Revises: 175b47f01804
Create Date: 2020-11-09 19:06:55.720897

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '90bdca2461e4'
down_revision = '175b47f01804'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('diagnosis', sa.Column('visit_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'diagnosis', 'visit', ['visit_id'], ['id'])
    op.drop_constraint('visit_diagnosis_id_fkey', 'visit', type_='foreignkey')
    op.drop_column('visit', 'diagnosis_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('visit', sa.Column('diagnosis_id', sa.INTEGER(), autoincrement=False, nullable=False))
    op.create_foreign_key('visit_diagnosis_id_fkey', 'visit', 'diagnosis', ['diagnosis_id'], ['id'])
    op.drop_constraint(None, 'diagnosis', type_='foreignkey')
    op.drop_column('diagnosis', 'visit_id')
    # ### end Alembic commands ###
