Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@roblambell
Copy link
Contributor

@roblambell roblambell commented Dec 17, 2024

Looks like a migration was realigning after some incident, but we do not have a foreign key constraint it's removing.

This PR makes the statement conditional.

When upgrading from v20241011 to latest:

Before

# dispatch database upgrade
[..]
INFO:Running upgrade 3edb0476365a -> 928b725d64f6, Fixes automatic generation issues:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:run_migrations:618
Traceback (most recent call last):
[..]
  File "/usr/local/lib/python3.11/site-packages/dispatch/database/revisions/tenant/versions/2024-11-04_928b725d64f6.py", line 55, in upgrade
    op.drop_constraint("project_stable_priority_id_fkey", "project", type_="foreignkey")
[..]
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject) constraint "project_stable_priority_id_fkey" of relation "project" does not exist

[SQL: ALTER TABLE project DROP CONSTRAINT project_stable_priority_id_fkey]
(Background on this error at: http://sqlalche.me/e/13/f405)

After

# dispatch database upgrade
[..]
INFO:Running upgrade 3edb0476365a -> 928b725d64f6, Fixes automatic generation issues:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update 3edb0476365a to 928b725d64f6:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:update_to_step:861
INFO:Running upgrade 928b725d64f6 -> 575ca7d954a8, Adds incident summary to the incident table.:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update 928b725d64f6 to 575ca7d954a8:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:update_to_step:861
INFO:Running upgrade 575ca7d954a8 -> 2d9e4d392ea4, Adding display name to the projct model:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:run_migrations:618
DEBUG:update 575ca7d954a8 to 2d9e4d392ea4:/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py:update_to_step:861
Success.

…b725d64f6.py

Co-authored-by: David Whittaker <[email protected]>
Signed-off-by: Rob Lambell <[email protected]>
@roblambell roblambell requested a review from whitdog47 December 17, 2024 17:43
@whitdog47 whitdog47 added the bug Something isn't working label Dec 17, 2024
@whitdog47 whitdog47 merged commit 63f6bee into Netflix:master Dec 18, 2024
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants