mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-01-12 00:34:44 +00:00
Migration script for DB changes.
Create new relationship tables for IRBEVENT and IRB_STATUS. Change columns to relationships
This commit is contained in:
parent
495537f2c1
commit
f097b394b6
41
migrations/versions/c1b37c418abd_.py
Normal file
41
migrations/versions/c1b37c418abd_.py
Normal file
@ -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=''))
|
Loading…
x
Reference in New Issue
Block a user