fix(difs): Use PROTECT for shared debug files#110411
Merged
szokeasaurusrex merged 1 commit intomasterfrom Mar 16, 2026
Merged
Conversation
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Alter field file on projectdebugfile
--
-- (no-op) |
5d53727 to
4cdc2ba
Compare
4cdc2ba to
cc5376b
Compare
cc5376b to
779eb11
Compare
5d53727 to
f034483
Compare
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Alter field file on projectdebugfile
--
-- (no-op) |
jjbayer
approved these changes
Mar 12, 2026
f034483 to
2ec10ff
Compare
Contributor
Backend Test FailuresFailures on
|
vgrozdanic
approved these changes
Mar 16, 2026
`ProjectDebugFile.file` can now be shared by multiple rows. Update the Django relation from `CASCADE` to `PROTECT` so ORM deletes match the intended ownership model. Keep deleting the backing `File` as a best-effort cleanup step after deleting a `ProjectDebugFile`, but leave it in place when another `ProjectDebugFile` still references it. This prepares us for [#106947](#106947), where aliasing is a concrete use case for shared `File` rows. The database should already reject deleting a referenced `File`; this change makes Django raise `ProtectedError` instead of relying on a DB-level failure path.
2ec10ff to
cc7ad3a
Compare
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Alter field file on projectdebugfile
--
-- (no-op) |
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.
ProjectDebugFile.filecan now be shared by multiple rows.Update the Django relation from
CASCADEtoPROTECTso ORM deletes match the intended ownership model. Keep deleting the backingFileas a best-effort cleanup step after deleting aProjectDebugFile, but leave it in place when anotherProjectDebugFilestill references it.This prepares us for #106947, where the solution will be to allow multiple
ProjectDebugFiles to share a singleFilerow.The database should already reject deleting a referenced
File; this change makes Django raiseProtectedErrorinstead of relying on a DB-level failure path.