From bcb6e154493463457f82f01bbd917b15386a05bd Mon Sep 17 00:00:00 2001 From: lwark Date: Wed, 4 Sep 2024 14:01:18 -0500 Subject: [PATCH] Adding in viral culture submissions. --- .../ef1a0222b882_adding_viral_cultures.py | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 alembic/versions/ef1a0222b882_adding_viral_cultures.py diff --git a/alembic/versions/ef1a0222b882_adding_viral_cultures.py b/alembic/versions/ef1a0222b882_adding_viral_cultures.py new file mode 100644 index 0000000..881f2e1 --- /dev/null +++ b/alembic/versions/ef1a0222b882_adding_viral_cultures.py @@ -0,0 +1,56 @@ +"""Adding Viral Cultures + +Revision ID: ef1a0222b882 +Revises: 0746f7e2c10e +Create Date: 2024-09-04 10:23:39.245013 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'ef1a0222b882' +down_revision = '0746f7e2c10e' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('_viralculture', + sa.Column('id', sa.INTEGER(), nullable=False), + sa.ForeignKeyConstraint(['id'], ['_basicsubmission.id'], ), + sa.PrimaryKeyConstraint('id') + ) + # with op.batch_alter_table('_process', schema=None) as batch_op: + # batch_op.create_unique_constraint("process_uni", ['name']) + # + # with op.batch_alter_table('_submissionsampleassociation', schema=None) as batch_op: + # batch_op.create_unique_constraint("subsamp_uni", ['id']) + + # with op.batch_alter_table('_wastewaterarticassociation', schema=None) as batch_op: + # batch_op.alter_column('source_plate', + # existing_type=sa.VARCHAR(length=16), + # type_=sa.String(length=32), + # existing_nullable=True) + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('_wastewaterarticassociation', schema=None) as batch_op: + batch_op.alter_column('source_plate', + existing_type=sa.String(length=32), + type_=sa.VARCHAR(length=16), + existing_nullable=True) + + with op.batch_alter_table('_submissionsampleassociation', schema=None) as batch_op: + batch_op.drop_constraint("subsamp_uni", type_='unique') + + with op.batch_alter_table('_process', schema=None) as batch_op: + batch_op.drop_constraint("process_uni", type_='unique') + + op.drop_table('_viralculture') + # ### end Alembic commands ###