-
Notifications
You must be signed in to change notification settings - Fork 0
/
schwartz.sql
107 lines (81 loc) · 2.24 KB
/
schwartz.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
CREATE AGGREGATE array_accum (
BASETYPE = anyelement,
SFUNC = array_append,
STYPE = anyarray,
INITCOND = '{}'
);
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE error (
error_time integer NOT NULL,
jobid bigint NOT NULL,
message varchar(255) NOT NULL,
funcid integer DEFAULT 0 NOT NULL
);
CREATE TABLE exitstatus (
jobid bigint NOT NULL,
funcid integer DEFAULT 0 NOT NULL,
status smallint,
completion_time integer,
delete_after integer
);
CREATE TABLE funcmap (
funcid serial NOT NULL,
funcname varchar(255) NOT NULL
);
CREATE TABLE job (
jobid serial NOT NULL,
funcid integer NOT NULL,
arg bytea,
uniqkey varchar(255),
insert_time integer,
run_after integer NOT NULL,
grabbed_until integer NOT NULL,
priority smallint,
"coalesce" varchar(255)
);
CREATE TABLE note (
jobid bigint NOT NULL,
notekey varchar(255) NOT NULL,
value bytea
);
ALTER TABLE ONLY exitstatus
ADD CONSTRAINT exitstatus_pkey
PRIMARY KEY (jobid);
ALTER TABLE ONLY funcmap
ADD CONSTRAINT funcmap_funcname_key
UNIQUE (funcname);
ALTER TABLE ONLY funcmap
ADD CONSTRAINT funcmap_pkey
PRIMARY KEY (funcid);
ALTER TABLE ONLY job
ADD CONSTRAINT job_funcid_key
UNIQUE (funcid, uniqkey);
ALTER TABLE ONLY job
ADD CONSTRAINT job_pkey
PRIMARY KEY (jobid);
ALTER TABLE ONLY note
ADD CONSTRAINT note_pkey
PRIMARY KEY (jobid, notekey);
CREATE INDEX error_funcid_errortime
ON error (funcid, error_time);
CREATE INDEX error_jobid
ON error (jobid);
CREATE INDEX error_time
ON error (error_time);
CREATE INDEX exitstatus_deleteafter
ON exitstatus (delete_after);
CREATE INDEX exitstatus_funcid
ON exitstatus (funcid);
CREATE INDEX ix_job_piro_non_null
ON job ((COALESCE((priority)::integer, 0)));
CREATE INDEX job_coalesce
ON job ("coalesce" text_pattern_ops);
CREATE INDEX job_funcid_coalesce
ON job (funcid, "coalesce" text_pattern_ops);
CREATE INDEX job_funcid_runafter
ON job (funcid, run_after);