Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/migration0073 #1290

Merged
merged 2 commits into from
Jan 15, 2025
Merged

bugfix/migration0073 #1290

merged 2 commits into from
Jan 15, 2025

Conversation

gecBurton
Copy link
Collaborator

@gecBurton gecBurton commented Jan 15, 2025

Context

migration 0073 is not running in production

this is due to a subtly in the way django creates many-to-many tables.

previously the many to many relationship was established via the Citation model that had a foreign key to both the chat_message and file, where there maybe many citations with referencing the same chat_message and file. The django ManyToMany relationship creates a very similar through model but it enforces a uniqueness constraint on the foreign keys which caused the error.

Changes proposed in this pull request

  • 306f9f0: extend test by adding two citations with the same chat_message and file, note that this fails with the same error we see in prod could not create unique index "redbox_core_chatmessage__chatmessage_id_file_id_bd4360c8_uniq"
  • bafde4b fix the migration by removing the "duplicate" citations

Guidance to review

Relevant links

Things to check

  • I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed
  • I have run integration tests

@gecBurton gecBurton force-pushed the bugfix/migration-73 branch from 97943a8 to 306f9f0 Compare January 15, 2025 14:12
@gecBurton gecBurton merged commit 8e8bd0b into main Jan 15, 2025
6 checks passed
@gecBurton gecBurton deleted the bugfix/migration-73 branch January 24, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants