We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad8b7cc commit d25fbbcCopy full SHA for d25fbbc
prisma/migrations/20230708000037_add_trigger_for_testcase_sync/migration.sql
@@ -0,0 +1,25 @@
1
+ALTER TYPE "SyncStatus" ADD VALUE 'DELETE';
2
+
3
+CREATE OR REPLACE FUNCTION public.notify_task_sync()
4
+ RETURNS trigger
5
+ LANGUAGE plpgsql
6
+AS $function$
7
+ declare
8
+ task_id text;
9
+ begin
10
+ task_id := new.task_id;
11
+ if new.sync_status = 'PENDING' or new.sync_status = 'DELETE' then
12
+ perform pg_notify('testcase_sync', task_id);
13
+ end if;
14
+ return new;
15
+ END;
16
+$function$
17
+;
18
19
20
+CREATE TRIGGER create_new_task AFTER
21
+INSERT
22
+ OR
23
+UPDATE
24
+ ON
25
+ public.testcase_sync_status for each ROW EXECUTE FUNCTION notify_task_sync();
0 commit comments