1 |
5138
|
daigle
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2009 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
*
|
6 |
|
|
* '$Author: daigle $'
|
7 |
|
|
* '$Date: 2009-08-14 14:26:08 -0700 (Fri, 14 Aug 2009) $'
|
8 |
|
|
* '$Revision: 5027 $'
|
9 |
|
|
*
|
10 |
|
|
* This program is free software, you can redistribute it and/or modify
|
11 |
|
|
* it under the terms of the GNU General Public License as published by
|
12 |
|
|
* the Free Software Foundation, either version 2 of the License, or
|
13 |
|
|
* (at your option) any later version.
|
14 |
|
|
*
|
15 |
|
|
* This program is distributed in the hope that it will be useful,
|
16 |
|
|
* but WITHOUT ANY WARRANTY, without even the implied warranty of
|
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
* GNU General Public License for more details.
|
19 |
|
|
*
|
20 |
|
|
* You should have received a copy of the GNU General Public License
|
21 |
|
|
* along with this program, if not, write to the Free Software
|
22 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
/*
|
26 |
|
|
* db_version -- table to store the version history of this database
|
27 |
|
|
*/
|
28 |
|
|
CREATE SEQUENCE db_version_id_seq;
|
29 |
|
|
CREATE TABLE db_version (
|
30 |
|
|
db_version_id INT8 default nextval ('db_version_id_seq'), -- the identifier for the version
|
31 |
|
|
version VARCHAR(250), -- the version number
|
32 |
|
|
status INT8, -- status of the version
|
33 |
|
|
date_created TIMESTAMP, -- the datetime on which the version was created
|
34 |
|
|
CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
|
35 |
|
|
);
|
36 |
|
|
|
37 |
|
|
/*
|
38 |
|
|
* scheduled_job -- table to store scheduled jobs
|
39 |
|
|
*/
|
40 |
|
|
CREATE SEQUENCE scheduled_job_id_seq;
|
41 |
|
|
CREATE TABLE scheduled_job (
|
42 |
|
|
id INT8 NOT NULL default nextval('scheduled_job_id_seq'),
|
43 |
|
|
date_created TIMESTAMP NOT NULL,
|
44 |
|
|
date_updated TIMESTAMP NOT NULL,
|
45 |
|
|
status VARCHAR(64) NOT NULL,
|
46 |
|
|
name VARCHAR(512) NOT NULL,
|
47 |
|
|
trigger_name VARCHAR(512) NOT NULL,
|
48 |
|
|
group_name VARCHAR(512) NOT NULL,
|
49 |
|
|
class_name VARCHAR(1024) NOT NULL,
|
50 |
|
|
start_time TIMESTAMP NOT NULL,
|
51 |
|
|
end_time TIMESTAMP,
|
52 |
|
|
interval_value INT NOT NULL,
|
53 |
|
|
interval_unit VARCHAR(8) NOT NULL,
|
54 |
|
|
CONSTRAINT scheduled_job_pk PRIMARY KEY (id),
|
55 |
|
|
CONSTRAINT scheduled_job_uk UNIQUE (name)
|
56 |
|
|
);
|
57 |
|
|
|
58 |
|
|
/*
|
59 |
|
|
* scheduled_job_params -- table to store scheduled jobs
|
60 |
|
|
*/
|
61 |
|
|
CREATE SEQUENCE scheduled_job_params_id_seq;
|
62 |
|
|
CREATE TABLE scheduled_job_params (
|
63 |
|
|
id INT8 NOT NULL default nextval('scheduled_job_params_id_seq'),
|
64 |
|
|
date_created TIMESTAMP NOT NULL,
|
65 |
|
|
date_updated TIMESTAMP NOT NULL,
|
66 |
|
|
status VARCHAR(64) NOT NULL,
|
67 |
|
|
job_id INT8 NOT NULL,
|
68 |
|
|
key VARCHAR(64) NOT NULL,
|
69 |
|
|
value VARCHAR(1024) NOT NULL,
|
70 |
|
|
CONSTRAINT scheduled_job_params_pk PRIMARY KEY (id),
|
71 |
|
|
CONSTRAINT scheduled_job_params_fk
|
72 |
|
|
FOREIGN KEY (job_id) REFERENCES scheduled_job(id)
|
73 |
|
|
);
|