Procedural scheduling migration fix patch #1601
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.
Fixes an issue discovered by @parkerabercrombie during database migration while upgrading from Aerie
2.11.2
to3.1.0
:2.11.2
, there was a plan that had some scheduling goals which were run, and produced scheduling goal analysis rows in the database.goal_id
which was no longer in the plan spec (didn't cause any issues yet).up.sql
migration10
assignsgoal_invocation_id
s to all goal invocations in the plan spec, and propagates these IDs to the corresponding entries in the goal analysis tables.null
as theirgoal_invocation_id
, which is not legal to be used as part of a primary keyThis PR fixes the issue by assigning a "dummy value" to any goal analysis rows which would have suffered from this problem - instead of setting the
goal_invocation_id
to null, we (somewhat arbitrarily) set it to the negative of the goal id which instantiated it. This could have been any valid integer, but we decided to use this as the value since it gives us a bit more information about where the analysis came from.(summarized by @dandelany )