remove explicit project column from notifications #16492
Merged
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/wp/57351
What are you trying to accomplish?
The bug is caused by notifications having references to a deleted project. The project reference is not strictly necessary to have on notifications. It can be fetched from the resource (e.g. work package) that is notified on.
What approach did you choose and why?
The
project_id
column is removed from thenotifications
table. That way, the reference need not be maintained any more. It can still be fetched from the resource. That is done to keep the Notification representation intact, so no change to the API takes place.This comes at the cost of more complicated queries particularly when sorting/grouping/filtering in the
NotificationQuery
. They for now have become way more WorkPackage specific. That query however was already work package specific given the way the visibility was checked.The alternative would be to keep the
project
reference. In that case, whenever any resource is moved, the reference would have to be updated. That approach seems to be quite error prone, which is why it was discarded.Merge checklist