Repository navigation
refactor: keep the author of commits until the code that deletes a profile clears it - #1376
Merged
Merged
Conversation
Contributor
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.
Summary
Part of letting organizations post commits (#938): deleting a profile no longer clears the author of its commits in the database.
DeleteUserandDeleteOrganizationalready clear it in code before deleting the profile, so a deletion path that forgets to now fails, instead of leaving a live commit without its author.ON DELETE SET NULLoncommits.author_idwas only there for #1346's deploy window, while code that posted commits without an author was still running. That code is gone, and the app's rule is that deletion logic lives in code.Changes
commits_author_id_foreignbecomes a plain foreign key, with no action on delete.NOT VALID, then validated in a separate statement, so the scan doesn't hold up new commits.DeleteUserclearsauthor_idon the tombstones it leaves.DeleteOrganizationdeletes the organization's commits and clears their author before deleting the profile.DeleteUserandDeleteOrganizationleave no commit pointing at the deleted profile. With the plain key, they would now also fail on any missed cleanup.Limitations
Summary by CodeRabbit