"""initial commit Revision ID: 4cba0c1ffe03 Revises: Create Date: 2023-01-18 08:59:34.382715 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '4cba0c1ffe03' down_revision = None branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('_contacts', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('email', sa.String(length=64), nullable=True), sa.Column('phone', sa.String(length=32), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('_control_types', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('targets', sa.JSON(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('_kits', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('used_for', sa.JSON(), nullable=True), sa.Column('cost_per_run', sa.FLOAT(precision=2), nullable=True), sa.Column('reagent_types_id', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['reagent_types_id'], ['_reagent_types.id'], name='fk_KT_reagentstype_id', ondelete='SET NULL', use_alter=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('_reagent_types', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('kit_id', sa.INTEGER(), nullable=True), sa.Column('eol_ext', sa.Interval(), nullable=True), sa.ForeignKeyConstraint(['kit_id'], ['_kits.id'], name='fk_RT_kits_id', ondelete='SET NULL', use_alter=True), sa.PrimaryKeyConstraint('id') ) op.create_table('_ww_samples', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('ww_processing_num', sa.String(length=64), nullable=True), sa.Column('ww_sample_full_id', sa.String(length=64), nullable=True), sa.Column('rsl_number', sa.String(length=64), nullable=True), sa.Column('collection_date', sa.TIMESTAMP(), nullable=True), sa.Column('testing_type', sa.String(length=64), nullable=True), sa.Column('site_status', sa.String(length=64), nullable=True), sa.Column('notes', sa.String(length=2000), nullable=True), sa.Column('ct_n1', sa.FLOAT(precision=2), nullable=True), sa.Column('ct_n2', sa.FLOAT(precision=2), nullable=True), sa.Column('seq_submitted', sa.BOOLEAN(), nullable=True), sa.Column('ww_seq_run_id', sa.String(length=64), nullable=True), sa.Column('sample_type', sa.String(length=8), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('_control_samples', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('parent_id', sa.String(), nullable=True), sa.Column('name', sa.String(length=255), nullable=True), sa.Column('submitted_date', sa.TIMESTAMP(), nullable=True), sa.Column('contains', sa.JSON(), nullable=True), sa.Column('matches', sa.JSON(), nullable=True), sa.Column('kraken', sa.JSON(), nullable=True), sa.ForeignKeyConstraint(['parent_id'], ['_control_types.id'], name='fk_control_parent_id'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('_organizations', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('cost_centre', sa.String(), nullable=True), sa.Column('contact_ids', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['contact_ids'], ['_contacts.id'], name='fk_org_contact_id', ondelete='SET NULL'), sa.PrimaryKeyConstraint('id') ) op.create_table('_reagents', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('type_id', sa.INTEGER(), nullable=True), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('lot', sa.String(length=64), nullable=True), sa.Column('expiry', sa.TIMESTAMP(), nullable=True), sa.ForeignKeyConstraint(['type_id'], ['_reagent_types.id'], name='fk_reagent_type_id', ondelete='SET NULL'), sa.PrimaryKeyConstraint('id') ) op.create_table('_reagentstypes_kittypes', sa.Column('reagent_types_id', sa.INTEGER(), nullable=True), sa.Column('kits_id', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['kits_id'], ['_kits.id'], ), sa.ForeignKeyConstraint(['reagent_types_id'], ['_reagent_types.id'], ) ) op.create_table('_orgs_contacts', sa.Column('org_id', sa.INTEGER(), nullable=True), sa.Column('contact_id', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['contact_id'], ['_contacts.id'], ), sa.ForeignKeyConstraint(['org_id'], ['_organizations.id'], ) ) op.create_table('_submissions', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('rsl_plate_num', sa.String(length=32), nullable=True), sa.Column('submitter_plate_num', sa.String(length=127), nullable=True), sa.Column('submitted_date', sa.TIMESTAMP(), nullable=True), sa.Column('submitting_lab_id', sa.INTEGER(), nullable=True), sa.Column('sample_count', sa.INTEGER(), nullable=True), sa.Column('extraction_kit_id', sa.INTEGER(), nullable=True), sa.Column('submission_type', sa.String(length=32), nullable=True), sa.Column('technician', sa.String(length=64), nullable=True), sa.Column('reagents_id', sa.String(), nullable=True), sa.Column('control_id', sa.INTEGER(), nullable=True), sa.Column('sample_id', sa.String(), nullable=True), sa.ForeignKeyConstraint(['control_id'], ['_control_samples.id'], name='fk_BC_control_id', ondelete='SET NULL'), sa.ForeignKeyConstraint(['extraction_kit_id'], ['_kits.id'], ondelete='SET NULL'), sa.ForeignKeyConstraint(['reagents_id'], ['_reagents.id'], name='fk_BS_reagents_id', ondelete='SET NULL'), sa.ForeignKeyConstraint(['sample_id'], ['_ww_samples.id'], name='fk_WW_sample_id', ondelete='SET NULL'), sa.ForeignKeyConstraint(['submitting_lab_id'], ['_organizations.id'], ondelete='SET NULL'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('rsl_plate_num'), sa.UniqueConstraint('submitter_plate_num') ) op.create_table('_reagents_submissions', sa.Column('reagent_id', sa.INTEGER(), nullable=True), sa.Column('submission_id', sa.INTEGER(), nullable=True), sa.ForeignKeyConstraint(['reagent_id'], ['_reagents.id'], ), sa.ForeignKeyConstraint(['submission_id'], ['_submissions.id'], ) ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('_reagents_submissions') op.drop_table('_submissions') op.drop_table('_orgs_contacts') op.drop_table('_reagentstypes_kittypes') op.drop_table('_reagents') op.drop_table('_organizations') op.drop_table('_control_samples') op.drop_table('_ww_samples') op.drop_table('_reagent_types') op.drop_table('_kits') op.drop_table('_control_types') op.drop_table('_contacts') # ### end Alembic commands ###