Skip to content

Commit

Permalink
fix(db): make migration statement conditional (#5625)
Browse files Browse the repository at this point in the history
* fix: make migration statement conditional

* Update src/dispatch/database/revisions/tenant/versions/2024-11-04_928b725d64f6.py

Co-authored-by: David Whittaker <[email protected]>
Signed-off-by: Rob Lambell <[email protected]>

---------

Signed-off-by: Rob Lambell <[email protected]>
Co-authored-by: David Whittaker <[email protected]>
  • Loading branch information
roblambell and whitdog47 authored Dec 18, 2024
1 parent 1150a71 commit 63f6bee
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ def upgrade():
if column_exists:
op.drop_column("plugin_instance", "configuration")

op.drop_constraint("project_stable_priority_id_fkey", "project", type_="foreignkey")
foreign_keys = inspector.get_foreign_keys("project")

constraint_name = "project_stable_priority_id_fkey"
constraint_exists = any(fk["name"] == constraint_name for fk in foreign_keys)
if constraint_exists:
op.drop_constraint(constraint_name, "project", type_="foreignkey")
# ### end Alembic commands ###


Expand Down

0 comments on commit 63f6bee

Please sign in to comment.