Skip to content

Commit

Permalink
Handles the case where goals are deleted from a spec before procedura…
Browse files Browse the repository at this point in the history
…l scheduling migration is applied
  • Loading branch information
skovati committed Nov 12, 2024
1 parent f271123 commit 1d9d5d1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions deployment/hasura/migrations/Aerie/10_procedural_scheduling/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ from scheduler.scheduling_request as sr
where sr.analysis_id = sga.analysis_id
and sga.goal_id = ssg.goal_id;

-- v3.1.1 migration patch addition
update scheduler.scheduling_goal_analysis
set goal_invocation_id = -1 * goal_id
where goal_invocation_id is null;

alter table scheduler.scheduling_goal_analysis
-- explictly set not null before PKing
alter column goal_invocation_id set not null,
Expand All @@ -53,6 +58,11 @@ from scheduler.scheduling_request as sr
where sr.analysis_id = sgaca.analysis_id
and sgaca.goal_id = ssg.goal_id;

-- v3.1.1 migration patch addition
update scheduler.scheduling_goal_analysis_created_activities
set goal_invocation_id = -1 * goal_id
where goal_invocation_id is null;

alter table scheduler.scheduling_goal_analysis_created_activities
drop column goal_id,
drop column goal_revision,
Expand Down Expand Up @@ -85,6 +95,11 @@ from scheduler.scheduling_request as sr
where sr.analysis_id = sgasa.analysis_id
and sgasa.goal_id = ssg.goal_id;

-- v3.1.1 migration patch addition
update scheduler.scheduling_goal_analysis_satisfying_activities
set goal_invocation_id = -1 * goal_id
where goal_invocation_id is null;

alter table scheduler.scheduling_goal_analysis_satisfying_activities
drop column goal_id,
drop column goal_revision,
Expand Down

0 comments on commit 1d9d5d1

Please sign in to comment.