From 1d9d5d144beda7518f9afac834337238a7cf9c3d Mon Sep 17 00:00:00 2001 From: "(skovati) Luke" Date: Tue, 12 Nov 2024 11:20:59 -0800 Subject: [PATCH] Handles the case where goals are deleted from a spec before procedural scheduling migration is applied --- .../Aerie/10_procedural_scheduling/up.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/deployment/hasura/migrations/Aerie/10_procedural_scheduling/up.sql b/deployment/hasura/migrations/Aerie/10_procedural_scheduling/up.sql index 7d48b297bd..9a5b48e20d 100644 --- a/deployment/hasura/migrations/Aerie/10_procedural_scheduling/up.sql +++ b/deployment/hasura/migrations/Aerie/10_procedural_scheduling/up.sql @@ -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, @@ -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, @@ -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,