39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""making sample ids unique
|
|
|
|
Revision ID: 78178df0286a
|
|
Revises: 4c6221f01324
|
|
Create Date: 2023-07-26 13:55:41.864399
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '78178df0286a'
|
|
down_revision = '4c6221f01324'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_bc_samples', schema=None) as batch_op:
|
|
batch_op.create_unique_constraint("unique_bc_sample", ['sample_id'])
|
|
|
|
with op.batch_alter_table('_ww_samples', schema=None) as batch_op:
|
|
batch_op.create_unique_constraint("unique_ww_sample", ['ww_sample_full_id'])
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_ww_samples', schema=None) as batch_op:
|
|
batch_op.drop_constraint(None, type_='unique')
|
|
|
|
with op.batch_alter_table('_bc_samples', schema=None) as batch_op:
|
|
batch_op.drop_constraint(None, type_='unique')
|
|
|
|
# ### end Alembic commands ###
|