File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ set check_function_bodies = off;
2
+
3
+ CREATE OR REPLACE FUNCTION public .send_account_transfers_delete_temporal_activity()
4
+ RETURNS trigger
5
+ LANGUAGE plpgsql
6
+ SECURITY DEFINER
7
+ AS $function$
8
+ declare
9
+ paymaster bytea = ' \x b1b01dc21a6537af7f9a46c76276b14fd7ceac67' ::bytea ;
10
+ workflow_ids text [];
11
+ begin
12
+ -- Check if it's from or to paymaster
13
+ if (NEW .f is not null and NEW .f = paymaster) or
14
+ (NEW .t is not null and NEW .t = paymaster) then
15
+ return NEW;
16
+ end if;
17
+ -- Only proceed with deletions if we have workflow IDs
18
+ delete from public .activity a
19
+ where a .event_name = ' temporal_send_account_transfers'
20
+ and a .event_id in (select t_sat .workflow_id
21
+ from temporal .send_account_transfers t_sat
22
+ where t_sat .created_at_block_num <= NEW .block_num
23
+ and t_sat .status != ' failed' );
24
+ return NEW;
25
+ end;
26
+ $function$
27
+ ;
28
+
29
+
You can’t perform that action at this time.
0 commit comments