fix: Correctly handle semantic ID counter on project copy#23121
Merged
Conversation
Contributor
Author
|
Sidenote: This made me realize that if we copy a project along with its WPs, the new semantic numbering may not match the old one. This can happen due to variety of reasons:
Let's also decide how much we care about this. |
Deploying openproject with ⚡ PullPreview
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Ticket
https://community.openproject.org/projects/communicator-stream/work_packages/74750
What are you trying to accomplish?
Fix the issue described in the ticket.
The root cause is that when
wp_sequence_counterhad non-zero value (= the project has had semantic IDs enabled and there is at least one WP), the copy mechanism attempted to copy it over to the new project, because it detected a difference from the default value (zero).However, since
wp_sequence_counterisn't declared as writable (since it's not specified inProjects::BaseContract), it trips up our own validation and the error propagates into the UI as the message visible in the parent ticket.What approach did you choose and why?
Let's just completely ignore that column during the copy process. The new project will get it initialized to 0, and then the counter gets organically gradually increased by the (optional) copying of all WPs from the old project.
Merge checklist