55 lines
2.4 KiB
Python
55 lines
2.4 KiB
Python
"""empty message
|
|
|
|
Revision ID: 64adf34a98db
|
|
Revises: 881cdb50a567
|
|
Create Date: 2023-06-27 15:13:03.219908
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '64adf34a98db'
|
|
down_revision = '881cdb50a567'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('task_draft_data',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('process_instance_id', sa.Integer(), nullable=False),
|
|
sa.Column('task_definition_id_path', sa.String(length=255), nullable=False),
|
|
sa.Column('saved_form_data_hash', sa.String(length=255), nullable=True),
|
|
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('process_instance_id', 'task_definition_id_path', name='process_instance_task_definition_unique')
|
|
)
|
|
with op.batch_alter_table('task_draft_data', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_task_draft_data_process_instance_id'), ['process_instance_id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_task_draft_data_saved_form_data_hash'), ['saved_form_data_hash'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_task_draft_data_task_definition_id_path'), ['task_definition_id_path'], unique=False)
|
|
|
|
with op.batch_alter_table('task', schema=None) as batch_op:
|
|
batch_op.drop_index('ix_task_saved_form_data_hash')
|
|
batch_op.drop_column('saved_form_data_hash')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('task', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('saved_form_data_hash', mysql.VARCHAR(collation='utf8mb4_0900_as_cs', length=255), nullable=True))
|
|
batch_op.create_index('ix_task_saved_form_data_hash', ['saved_form_data_hash'], unique=False)
|
|
|
|
with op.batch_alter_table('task_draft_data', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_task_draft_data_task_definition_id_path'))
|
|
batch_op.drop_index(batch_op.f('ix_task_draft_data_saved_form_data_hash'))
|
|
batch_op.drop_index(batch_op.f('ix_task_draft_data_process_instance_id'))
|
|
|
|
op.drop_table('task_draft_data')
|
|
# ### end Alembic commands ###
|