57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
"""Add custom info column to _basicsubmission
|
|
|
|
Revision ID: 25b86f5ac2d9
|
|
Revises: 0746f7e2c10e
|
|
Create Date: 2024-09-24 09:09:15.223556
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '25b86f5ac2d9'
|
|
down_revision = '0746f7e2c10e'
|
|
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('custom', sa.JSON(), nullable=True))
|
|
|
|
# with op.batch_alter_table('_process', schema=None) as batch_op:
|
|
# batch_op.create_unique_constraint(None, ['name'])
|
|
#
|
|
# with op.batch_alter_table('_submissionsampleassociation', schema=None) as batch_op:
|
|
# batch_op.create_unique_constraint(None, ['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(None, type_='unique')
|
|
#
|
|
# with op.batch_alter_table('_process', 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_column('custom')
|
|
|
|
# ### end Alembic commands ###
|