Files
Submissions-App/alembic/versions/b744e8a452fd_attaching_contact_to_submission.py
2024-06-13 13:47:30 -05:00

41 lines
1.3 KiB
Python

"""Attaching contact to submission
Revision ID: b744e8a452fd
Revises: f829a8ab292f
Create Date: 2024-06-04 14:21:38.163431
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b744e8a452fd'
down_revision = 'f829a8ab292f'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('_basicsubmission', schema=None) as batch_op:
batch_op.add_column(sa.Column('contact_id', sa.INTEGER(), nullable=True))
batch_op.create_foreign_key('fk_BS_contact_id', '_contact', ['contact_id'], ['id'], ondelete='SET NULL')
# with op.batch_alter_table('_submissionsampleassociation', schema=None) as batch_op:
# batch_op.create_unique_constraint(None, ['id'])
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# with op.batch_alter_table('_submissionsampleassociation', schema=None) as batch_op:
# batch_op.drop_constraint(None, type_='unique')
with op.batch_alter_table('_basicsubmission', schema=None) as batch_op:
batch_op.drop_constraint('fk_BS_contact_id', type_='foreignkey')
batch_op.drop_column('contact_id')
# ### end Alembic commands ###