Project

General

Profile

« Previous | Next » 

Revision 5138

Added by daigle almost 15 years ago

Create database scripts for workflow scheduler

View differences:

src/scripts/workflowscheduler-db-scripts/ws-tables-postgres.sql
1
/**
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
);
0 74

  
src/scripts/workflowscheduler-db-scripts/ws-loaddtdschema-postgres.sql
1
INSERT INTO db_version (version, status, date_created) 
2
  VALUES ('1.1.1',1,CURRENT_DATE);
0 3

  
src/scripts/workflowscheduler-db-scripts/ws-create-db.txt
1
Instructions on initially creating the workflow scheduler database.
2

  
3
Update postgres configuration
4
	Edit:
5
		/etc/postgresql/<postgres_version>/main/pg_hba.conf
6
	Add the following Line:
7
		host workflowscheduler workflowscheduler 127.0.0.1 255.255.255.255 password
8
		
9
Create database:
10
	type: createdb metacat
11
	
12
Create workflowscheduler user
13
	Log in to postgreSQL by typing: 
14
		psql metacat
15
	At the psql prompt, create the workflowscheduler user by typing:
16
		CREATE USER workflowscheduler WITH UNENCRYPTED PASSWORD 'your_password';
17
    where 'your_password' is whatever password you would like for the workflowscheduler user.
18
	Exit PostgreSQL by typing:
19
		\q
20
	Restart the PostgreSQL database to bring in changes:
21
     	/etc/init.d/postgresql-8.3 restart
22
     	
23
Test setup
24
	Log out of the postgres user account by typing:
25
		logout
26
	Test the installation and workflowscheduler account by typing:
27
		psql -U workflowscheduler -W -h localhost workflowscheduler
28
		
29
Create tables:
30
	Open the table creation script in this directory called:
31
		ws-tables-postgres.sql
32
	Copy each sql command and run in psql prompt.
33
	
34
Populate tables
35
	Open the table creation script in this directory called:
36
		ws-loaddtdschema-postgres.sql
37
	Copy each sql command and run in psql prompt.
38
		

Also available in: Unified diff