Skip to content

Commit

Permalink
Add "order by" when populating a plan spec
Browse files Browse the repository at this point in the history
Avoids temporary priority gaps when initially populating the spec, which will cause a constraint violation
  • Loading branch information
Mythicaeda committed Apr 17, 2024
1 parent 41d37c4 commit fc40bde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ begin
insert into scheduler.scheduling_specification_goals (specification_id, goal_id, goal_revision, priority)
select spec_id, msg.goal_id, msg.goal_revision, msg.priority
from scheduler.scheduling_model_specification_goals msg
where msg.model_id = new.model_id;
where msg.model_id = new.model_id
order by msg.priority;

insert into scheduler.scheduling_specification_conditions (specification_id, condition_id, condition_revision)
select spec_id, msc.condition_id, msc.condition_revision
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ begin
insert into scheduler.scheduling_specification_goals (specification_id, goal_id, goal_revision, priority)
select spec_id, msg.goal_id, msg.goal_revision, msg.priority
from scheduler.scheduling_model_specification_goals msg
where msg.model_id = new.model_id;
where msg.model_id = new.model_id
order by msg.priority;

insert into scheduler.scheduling_specification_conditions (specification_id, condition_id, condition_revision)
select spec_id, msc.condition_id, msc.condition_revision
Expand Down

0 comments on commit fc40bde

Please sign in to comment.