35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""link controls with Bacterial Culture Samples
|
|
|
|
Revision ID: 2684f065037c
|
|
Revises: 7e7b6eeca468
|
|
Create Date: 2023-12-05 10:29:31.126732
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2684f065037c'
|
|
down_revision = '7e7b6eeca468'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_control_samples', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('sample_id', sa.INTEGER(), nullable=True))
|
|
batch_op.create_foreign_key('cont_BCS_id', '_samples', ['sample_id'], ['id'], ondelete='SET NULL')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_control_samples', schema=None) as batch_op:
|
|
batch_op.drop_constraint('cont_BCS_id', type_='foreignkey')
|
|
batch_op.drop_column('sample_id')
|
|
|
|
# ### end Alembic commands ###
|