Skip to content

Commit 42b500a

Browse files
committed
New table for tracking exec status
1 parent 21f6203 commit 42b500a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/server/exec_table.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
-- Drop table
2+
3+
-- DROP TABLE public.execution_status;
4+
5+
CREATE TABLE public.execution_status (
6+
"_id" serial NOT NULL,
7+
job_id int8 NOT NULL,
8+
status varchar(32) NOT NULL,
9+
details varchar NOT NULL,
10+
update_stamp timestamp(0) NOT NULL DEFAULT now(),
11+
CONSTRAINT execution_status_pk PRIMARY KEY (_id)
12+
);
13+
14+
-- Table Triggers
15+
16+
create trigger last_upd_trigger before
17+
insert
18+
or
19+
update
20+
on
21+
public.execution_status for each row execute function last_upd_trig();
22+
23+
24+
--
25+
26+
CREATE FUNCTION last_upd_trig() RETURNS trigger
27+
LANGUAGE plpgsql AS
28+
$$BEGIN
29+
NEW.lastupdate := current_timestamp;
30+
RETURN NEW;
31+
END;$$;
32+
33+
CREATE TRIGGER last_upd_trigger
34+
BEFORE INSERT OR UPDATE ON finds
35+
FOR EACH ROW
36+
EXECUTE PROCEDURE last_upd_trig();
37+
38+
39+
40+
41+
42+
create trigger last_upd_trigger before
43+
insert
44+
or
45+
update
46+
on
47+
public.execution_status for each row execute function last_upd_trig()

0 commit comments

Comments
 (0)