<reponame>all-of-us/raw-data-repository<gh_stars>10-100
"""genomic_gc_manifest_workflow

Revision ID: f5520e9dde27
Revises: <PASSWORD>
Create Date: 2020-02-12 15:52:30.417779

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

from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus
from rdr_service.participant_enums import WithdrawalStatus, WithdrawalReason, SuspensionStatus, QuestionnaireDefinitionStatus
from rdr_service.participant_enums import EnrollmentStatus, Race, SampleStatus, OrganizationType, BiobankOrderStatus
from rdr_service.participant_enums import OrderShipmentTrackingStatus, OrderShipmentStatus
from rdr_service.participant_enums import MetricSetType, MetricsKey, GenderIdentity
from rdr_service.model.base import add_table_history_table, drop_table_history_table
from rdr_service.model.code import CodeType
from rdr_service.model.site_enums import SiteStatus, EnrollingStatus, DigitalSchedulingStatus, ObsoleteStatus

# revision identifiers, used by Alembic.
revision = 'f5520e9dde27'
down_revision = '01e685241414'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()



def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('genomic_set_member', sa.Column('reconcile_gc_manifest_job_run_id', sa.Integer(), nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_metrics_bb_manifest_job_run_id', sa.Integer(), nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_metrics_sequencing_job_run_id', sa.Integer(), nullable=True))
    op.drop_constraint('genomic_set_member_ibfk_7', 'genomic_set_member', type_='foreignkey')
    op.drop_constraint('genomic_set_member_ibfk_4', 'genomic_set_member', type_='foreignkey')
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_metrics_sequencing_job_run_id'], ['id'])
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_metrics_bb_manifest_job_run_id'], ['id'])
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_gc_manifest_job_run_id'], ['id'])
    op.drop_column('genomic_set_member', 'reconcile_manifest_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_sequencing_job_run_id')
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('genomic_set_member', sa.Column('reconcile_sequencing_job_run_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_manifest_job_run_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.create_foreign_key('genomic_set_member_ibfk_4', 'genomic_set_member', 'genomic_job_run', ['reconcile_manifest_job_run_id'], ['id'])
    op.create_foreign_key('genomic_set_member_ibfk_7', 'genomic_set_member', 'genomic_job_run', ['reconcile_sequencing_job_run_id'], ['id'])
    op.drop_column('genomic_set_member', 'reconcile_metrics_sequencing_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_metrics_bb_manifest_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_gc_manifest_job_run_id')
    # ### end Alembic commands ###


def upgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


"""genomic_gc_manifest_workflow

Revision ID: f5520e9dde27
Revises: <PASSWORD>
Create Date: 2020-02-12 15:52:30.417779

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

from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus
from rdr_service.participant_enums import WithdrawalStatus, WithdrawalReason, SuspensionStatus, QuestionnaireDefinitionStatus
from rdr_service.participant_enums import EnrollmentStatus, Race, SampleStatus, OrganizationType, BiobankOrderStatus
from rdr_service.participant_enums import OrderShipmentTrackingStatus, OrderShipmentStatus
from rdr_service.participant_enums import MetricSetType, MetricsKey, GenderIdentity
from rdr_service.model.base import add_table_history_table, drop_table_history_table
from rdr_service.model.code import CodeType
from rdr_service.model.site_enums import SiteStatus, EnrollingStatus, DigitalSchedulingStatus, ObsoleteStatus

# revision identifiers, used by Alembic.
revision = 'f5520e9dde27'
down_revision = '01e685241414'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()



def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('genomic_set_member', sa.Column('reconcile_gc_manifest_job_run_id', sa.Integer(), nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_metrics_bb_manifest_job_run_id', sa.Integer(), nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_metrics_sequencing_job_run_id', sa.Integer(), nullable=True))
    op.drop_constraint('genomic_set_member_ibfk_7', 'genomic_set_member', type_='foreignkey')
    op.drop_constraint('genomic_set_member_ibfk_4', 'genomic_set_member', type_='foreignkey')
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_metrics_sequencing_job_run_id'], ['id'])
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_metrics_bb_manifest_job_run_id'], ['id'])
    op.create_foreign_key(None, 'genomic_set_member', 'genomic_job_run', ['reconcile_gc_manifest_job_run_id'], ['id'])
    op.drop_column('genomic_set_member', 'reconcile_manifest_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_sequencing_job_run_id')
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('genomic_set_member', sa.Column('reconcile_sequencing_job_run_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('genomic_set_member', sa.Column('reconcile_manifest_job_run_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.drop_constraint(None, 'genomic_set_member', type_='foreignkey')
    op.create_foreign_key('genomic_set_member_ibfk_4', 'genomic_set_member', 'genomic_job_run', ['reconcile_manifest_job_run_id'], ['id'])
    op.create_foreign_key('genomic_set_member_ibfk_7', 'genomic_set_member', 'genomic_job_run', ['reconcile_sequencing_job_run_id'], ['id'])
    op.drop_column('genomic_set_member', 'reconcile_metrics_sequencing_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_metrics_bb_manifest_job_run_id')
    op.drop_column('genomic_set_member', 'reconcile_gc_manifest_job_run_id')
    # ### end Alembic commands ###


def upgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_metrics():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###
genomic_gc_manifest_workflow  Revision ID: f5520e9dde27 Revises: <PASSWORD> Create Date: 2020-02-12 15:52:30.417779 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###