fix(api): Cleanup next_draft_id in versions state only on latest draft#325
Merged
kpsherva merged 1 commit intoinveniosoftware:masterfrom Mar 10, 2026
Merged
Conversation
zzacharo
reviewed
Mar 6, 2026
17eda9d to
bd959a3
Compare
zzacharo
approved these changes
Mar 9, 2026
ptamarit
requested changes
Mar 10, 2026
Member
ptamarit
left a comment
There was a problem hiding this comment.
Tests failing with Python 3.14
Contributor
this PR fixes it inveniosoftware/invenio-drafts-resources#326 |
ptamarit
approved these changes
Mar 10, 2026
* We check if the draft being hard deleted is the latest version draft, only in that case we need to remove the foreign key from the versions table * This fixes the cleanup_drafts task that runs every hour and deletes soft deleted drafts was setting the next_draft_id to None causing any new version draft to become orphaned. * It was also causing the new version creation flow to skip the orphan version to the next version's index resulting in holes in the version counter.
bd959a3 to
d52a0ba
Compare
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.
fixes: #324