removed human_task_ibfk_5 from old migration file and updated task id removal migration to work with both mysql and postgres w/ burnettk
This commit is contained in:
parent
ab9e823dcf
commit
3ac98e38c8
|
@ -446,7 +446,7 @@ def upgrade():
|
|||
sa.ForeignKeyConstraint(['completed_by_user_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['lane_assignment_id'], ['group.id'], ),
|
||||
sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ),
|
||||
sa.ForeignKeyConstraint(['task_model_id'], ['task.id'], name='human_task_ibfk_5'),
|
||||
sa.ForeignKeyConstraint(['task_model_id'], ['task.id']),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('human_task', schema=None) as batch_op:
|
||||
|
|
|
@ -20,6 +20,9 @@ depends_on = None
|
|||
def is_mysql() -> bool:
|
||||
return dialect_name() == 'mysql'
|
||||
|
||||
def is_postgres() -> bool:
|
||||
return dialect_name() == 'postgres'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
@ -31,7 +34,12 @@ def upgrade():
|
|||
|
||||
with op.batch_alter_table('human_task', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('task_guid', sa.String(length=36), nullable=True))
|
||||
batch_op.drop_constraint('human_task_ibfk_5', type_='foreignkey')
|
||||
|
||||
# sqlite does not seem to have this foreignkey constraint
|
||||
if is_postgres():
|
||||
batch_op.drop_constraint('human_task_task_model_id_fkey', type_='foreignkey')
|
||||
elif is_mysql():
|
||||
batch_op.drop_constraint('human_task_ibfk_5', type_='foreignkey')
|
||||
batch_op.drop_index('ix_human_task_task_model_id')
|
||||
batch_op.create_index(batch_op.f('ix_human_task_task_guid'), ['task_guid'], unique=False)
|
||||
batch_op.create_foreign_key('human_task_ibfk_task_guid', 'task', ['task_guid'], ['guid'])
|
||||
|
|
Loading…
Reference in New Issue