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

Revision 164, 1.9 kB (checked in by miyagawa, 7 months ago)

PostgreSQL patch from clkao

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);
36
37CREATE UNIQUE INDEX job_funcid_uniqkey ON job (funcid, uniqkey);
38
39CREATE INDEX job_funcid_runafter ON job (funcid, run_after);
40
41CREATE INDEX job_funcid_coalesce ON job (funcid, coalesce);
42
43CREATE TABLE note (
44        jobid           BIGINT NOT NULL,
45        notekey         VARCHAR(255),
46        PRIMARY KEY (jobid, notekey),
47        value           BYTEA
48);
49
50CREATE TABLE error (
51        error_time      INTEGER NOT NULL,
52        jobid           BIGINT NOT NULL,
53        message         VARCHAR(255) NOT NULL,
54        funcid          INT NOT NULL DEFAULT 0
55);
56
57CREATE INDEX error_funcid_errortime ON error (funcid, error_time);
58CREATE INDEX error_time ON error (error_time);
59CREATE INDEX error_jobid ON error (jobid);
60
61CREATE TABLE exitstatus (
62        jobid           BIGINT PRIMARY KEY NOT NULL,
63        funcid          INT NOT NULL DEFAULT 0,
64        status          SMALLINT,
65        completion_time INTEGER,
66        delete_after    INTEGER
67);
68
69CREATE INDEX exitstatus_funcid ON exitstatus (funcid);
70CREATE INDEX exitstatus_deleteafter ON exitstatus (delete_after);
71
Note: See TracBrowser for help on using the browser.