spiff-arena/spiffworkflow-backend/migrations/versions/d8901960326e_.py

45 lines
1.7 KiB
Python
Raw Normal View History

"""empty message
Revision ID: d8901960326e
Revises: 78f5c2c65bf3
Create Date: 2023-10-24 14:15:20.401370
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'd8901960326e'
down_revision = '78f5c2c65bf3'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('json_data', schema=None) as batch_op:
batch_op.drop_column('id')
batch_op.create_primary_key('hash_pk', ['hash'])
with op.batch_alter_table('task_draft_data', schema=None) as batch_op:
batch_op.drop_column('id')
batch_op.create_primary_key('process_instance_task_definition_pk', ['process_instance_id', 'task_definition_id_path'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('json_data', schema=None) as batch_op:
batch_op.drop_constraint('hash_pk', 'primary')
# NOTE: it does not actually add the autoincrement to the column which means if we ever need to put
# back the id column, we may have to create a new migration
batch_op.add_column(sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
batch_op.create_primary_key('id_pk', ['id'])
with op.batch_alter_table('task_draft_data', schema=None) as batch_op:
batch_op.drop_constraint('process_instance_task_definition_pk', 'primary')
batch_op.add_column(sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
batch_op.create_primary_key('id_pk', ['id'])
# ### end Alembic commands ###