root/trunk/doc/schema-postgres.sql @ 131

Revision 131, 1.9 kB (checked in by bradfitz, 2 years ago)

+ - include postgres schema in docs. from Michael Zedeler
+ <michael@…> Currently not tested in regression
+ tests, though, so not "officially" supported yet.

Line 
1-- From: Michael Zedeler <michael@zedeler.dk>
2-- Date: July 30, 2007 7:31:55 AM PDT
3-- To: cpan@sixapart.com
4-- Subject: TheSchwartz database schema for postgresql
5--
6-- Hi.
7--
8-- I couldn't find any useful postgresql compatible schema file for 
9-- the tables that TheSchwartz seems to depend on, so I rewrote the 
10-- one supplied in the package.
11--
12-- Here it is. Feel free to include it in the next release.
13--
14-- Regards,
15--
16-- Michael.
17
18
19CREATE TABLE funcmap (
20        funcid SERIAL,
21        funcname       VARCHAR(255) NOT NULL,
22        UNIQUE(funcname)
23);
24
25CREATE TABLE job (
26        jobid           SERIAL,
27        funcid          INT NOT NULL,
28        arg             BYTEA,
29        uniqkey         VARCHAR(255) NULL,
30        insert_time     INTEGER,
31        run_after       INTEGER NOT NULL,
32        grabbed_until   INTEGER NOT NULL,
33        priority        SMALLINT,
34        coalesce        VARCHAR(255),
35        UNIQUE(funcid, uniqkey)
36);
37
38CREATE INDEX job_funcid_runafter ON job (funcid, run_after);
39
40CREATE INDEX job_funcid_coalesce ON job (funcid, coalesce);
41
42CREATE TABLE note (
43        jobid           BIGINT NOT NULL,
44        notekey         VARCHAR(255),
45        PRIMARY KEY (jobid, notekey),
46        value           BYTEA
47);
48
49CREATE TABLE error (
50        error_time      INTEGER NOT NULL,
51        jobid           BIGINT NOT NULL,
52        message         VARCHAR(255) NOT NULL,
53        funcid          INT NOT NULL DEFAULT 0
54);
55
56CREATE INDEX error_funcid_errortime ON error (funcid, error_time);
57CREATE INDEX error_time ON error (error_time);
58CREATE INDEX error_jobid ON error (jobid);
59
60CREATE TABLE exitstatus (
61        jobid           BIGINT PRIMARY KEY NOT NULL,
62        funcid          INT NOT NULL DEFAULT 0,
63        status          SMALLINT,
64        completion_time INTEGER,
65        delete_after    INTEGER
66);
67
68CREATE INDEX exitstatus_funcid ON exitstatus (funcid);
69CREATE INDEX exitstatus_deleteafter ON exitstatus (delete_after);
70
Note: See TracBrowser for help on using the browser.