From f097b394b6899ada0d9d4ba02affa45bd88f2822 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Jun 2021 14:51:06 -0400 Subject: [PATCH] Migration script for DB changes. Create new relationship tables for IRBEVENT and IRB_STATUS. Change columns to relationships --- migrations/versions/c1b37c418abd_.py | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 migrations/versions/c1b37c418abd_.py diff --git a/migrations/versions/c1b37c418abd_.py b/migrations/versions/c1b37c418abd_.py new file mode 100644 index 0000000..80210bc --- /dev/null +++ b/migrations/versions/c1b37c418abd_.py @@ -0,0 +1,41 @@ +""" add irb_info_event and irb_info_status tables + +Revision ID: c1b37c418abd +Revises: 6c34576847ab +Create Date: 2021-06-17 12:40:05.411279 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'c1b37c418abd' +down_revision = '6c34576847ab' +branch_labels = None +depends_on = None + + +def upgrade(): + op.drop_column('irb_info', 'IRBEVENT') + op.create_table('irb_info_event', + sa.Column('STUDY_ID', sa.Integer(), nullable=False), + sa.Column('EVENT_ID', sa.String(), nullable=False, default=''), + sa.Column('EVENT', sa.String(), nullable=False, default=''), + sa.ForeignKeyConstraint(['STUDY_ID'], ['irb_info.SS_STUDY_ID'], ), + sa.PrimaryKeyConstraint('STUDY_ID')) + + op.drop_column('irb_info', 'IRB_STATUS') + op.create_table('irb_info_status', + sa.Column('STUDY_ID', sa.Integer(), nullable=False), + sa.Column('STATUS_ID', sa.String(), nullable=False), + sa.Column('STATUS', sa.String(), nullable=False), + sa.ForeignKeyConstraint(('STUDY_ID',), ['irb_info.SS_STUDY_ID'], ), + sa.PrimaryKeyConstraint('STUDY_ID')) + + +def downgrade(): + op.drop_table('irb_info_event') + op.add_column('irb_info', sa.Column('IRBEVENT', sa.String(), nullable=True, default='')) + op.drop_table('irb_info_status') + op.add_column('irb_info', sa.Column('IRB_STATUS', sa.String(), nullable=True, default=''))