-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1141 from NASA-AMMOS/fix/cancel-scheduling-rq-tri…
…gger Add cancel trigger to scheduling request
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
deployment/hasura/migrations/AerieScheduler/10_cancel_scheduling_trigger/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
drop trigger cancel_pending_scheduling_rqs on scheduling_request; | ||
drop function cancel_pending_scheduling_rqs(); | ||
|
||
call migrations.mark_migration_rolled_back('10'); |
19 changes: 19 additions & 0 deletions
19
deployment/hasura/migrations/AerieScheduler/10_cancel_scheduling_trigger/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
create function cancel_pending_scheduling_rqs() | ||
returns trigger | ||
security definer | ||
language plpgsql as $$ | ||
begin | ||
update scheduling_request | ||
set canceled = true | ||
where status = 'pending' | ||
and specification_id = new.specification_id; | ||
return new; | ||
end | ||
$$; | ||
|
||
create trigger cancel_pending_scheduling_rqs | ||
before insert on scheduling_request | ||
for each row | ||
execute function cancel_pending_scheduling_rqs(); | ||
|
||
call migrations.mark_migration_applied('10'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters