Skip to content

Commit 1388d24

Browse files
authored
Merge pull request #1631 from NASA-AMMOS/fix/before-delete-return-old
Fix "before delete" trigger on Scheduling Specification Conditions
2 parents ab573c3 + 294d992 commit 1388d24

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
create or replace function scheduler.increment_spec_revision_on_conditions_spec_delete()
2+
returns trigger
3+
security definer
4+
language plpgsql as $$
5+
begin
6+
update scheduler.scheduling_specification
7+
set revision = revision + 1
8+
where id = new.specification_id;
9+
return new;
10+
end;
11+
$$;
12+
call migrations.mark_migration_rolled_back('13');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
create or replace function scheduler.increment_spec_revision_on_conditions_spec_delete()
2+
returns trigger
3+
security definer
4+
language plpgsql as $$
5+
begin
6+
update scheduler.scheduling_specification
7+
set revision = revision + 1
8+
where id = new.specification_id;
9+
return old;
10+
end;
11+
$$;
12+
call migrations.mark_migration_applied('13');

deployment/postgres-init-db/sql/applied_migrations.sql

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ call migrations.mark_migration_applied('9');
1515
call migrations.mark_migration_applied('10');
1616
call migrations.mark_migration_applied('11');
1717
call migrations.mark_migration_applied('12');
18+
call migrations.mark_migration_applied('13');

deployment/postgres-init-db/sql/tables/scheduler/scheduling_specification/scheduling_specification_conditions.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ begin
5959
update scheduler.scheduling_specification
6060
set revision = revision + 1
6161
where id = new.specification_id;
62-
return new;
62+
return old;
6363
end;
6464
$$;
6565

0 commit comments

Comments
 (0)