[TTP2-21] Project deletion fails in project hierarchy with semantic work package IDs - #24761
Draft
op-chomper wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an AI-generated prototype.
gh adopt 24761(setup guide).📋 Implementation plan: https://gist.github.com/op-chomper/20ff7e42f5680037e3737f56df3bb207
Ticket
hxxps://qa.openproject-edge.com/work_packages/TTP2-21
What are you trying to accomplish?
Deleting a project failed when a work package in the project or a subproject had a semantic identifier. The database cascade removed the
work_packagesrows, but the foreign key fromwork_package_semantic_aliasestowork_packagesrestricted the delete. The result was aPG::ForeignKeyViolation, and the projects stayed in the database. This change makes that foreign key cascade, so the delete succeeds.What approach did you choose and why?
A new migration replaces the foreign key with an
on_delete: :cascadevariant. Thework_packages.project_idforeign key already cascades at the database level, which bypasses the ActiveRecorddependent: :delete_allon the association. A matching database cascade on the alias foreign key is the reliable fix. I did not edit the original create migration, because it has already run on development and staging databases.Screenshots
No visual changes.
Merge checklist