diff --git a/spiffworkflow-backend/migrations/versions/0c7428378d6e_.py b/spiffworkflow-backend/migrations/versions/0c7428378d6e_.py index 9fb330bfc..b4cd44286 100644 --- a/spiffworkflow-backend/migrations/versions/0c7428378d6e_.py +++ b/spiffworkflow-backend/migrations/versions/0c7428378d6e_.py @@ -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: diff --git a/spiffworkflow-backend/migrations/versions/3191627ae224_.py b/spiffworkflow-backend/migrations/versions/3191627ae224_.py index 52102cfba..9bcd5894d 100644 --- a/spiffworkflow-backend/migrations/versions/3191627ae224_.py +++ b/spiffworkflow-backend/migrations/versions/3191627ae224_.py @@ -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'])