1 |
2099
|
jones
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2004 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
*
|
6 |
|
|
* '$Author$'
|
7 |
|
|
* '$Date$'
|
8 |
|
|
* '$Revision$'
|
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 |
2096
|
jones
|
*/
|
24 |
2099
|
jones
|
|
25 |
2096
|
jones
|
/*
|
26 |
|
|
*Logging -- table to store metadata and data access log
|
27 |
|
|
*/
|
28 |
|
|
CREATE SEQUENCE access_log_id_seq;
|
29 |
|
|
CREATE TABLE access_log (
|
30 |
2099
|
jones
|
entryid INT8 default nextval ('access_log_id_seq'), -- the identifier for the log event
|
31 |
|
|
ip_address VARCHAR(512), -- the ip address inititiating the event
|
32 |
|
|
principal VARCHAR(512), -- the user initiiating the event
|
33 |
2096
|
jones
|
docid VARCHAR(250), -- the document id #
|
34 |
2099
|
jones
|
event VARCHAR(512), -- the code symbolizing the event type
|
35 |
|
|
date_logged TIMESTAMP, -- the datetime on which the event occurred
|
36 |
2096
|
jones
|
CONSTRAINT access_log_pk PRIMARY KEY (entryid)
|
37 |
|
|
);
|
38 |
2109
|
costa
|
|
39 |
|
|
/*
|
40 |
|
|
* harvest_site_schedule -- table to store harvest sites and schedule info
|
41 |
|
|
*/
|
42 |
|
|
CREATE TABLE harvest_site_schedule (
|
43 |
|
|
site_schedule_id INT8, -- unique id
|
44 |
|
|
documentlisturl VARCHAR(255), -- URL of the site harvest document list
|
45 |
|
|
ldapdn VARCHAR(255), -- LDAP distinguished name for site account
|
46 |
|
|
datenextharvest DATE, -- scheduled date of next harvest
|
47 |
|
|
datelastharvest DATE, -- recorded date of last harvest
|
48 |
|
|
updatefrequency INT8, -- the harvest update frequency
|
49 |
|
|
unit VARCHAR(50), -- update unit -- days weeks or months
|
50 |
|
|
contact_email VARCHAR(50), -- email address of the site contact person
|
51 |
|
|
ldappwd VARCHAR(20), -- LDAP password for site account
|
52 |
|
|
CONSTRAINT harvest_site_schedule_pk PRIMARY KEY (site_schedule_id)
|
53 |
|
|
);
|
54 |
|
|
|
55 |
|
|
/*
|
56 |
|
|
* harvest_log -- table to log entries for harvest operations
|
57 |
|
|
*/
|
58 |
|
|
CREATE TABLE harvest_log (
|
59 |
|
|
harvest_log_id INT8, -- unique id
|
60 |
|
|
harvest_date DATE, -- date of the current harvest
|
61 |
|
|
status INT8, -- non-zero indicates an error status
|
62 |
|
|
message VARCHAR(1000), -- text message for this log entry
|
63 |
|
|
harvest_operation_code VARCHAR(30), -- the type of harvest operation
|
64 |
2112
|
costa
|
site_schedule_id INT8, -- site schedule id, or 0 if no site
|
65 |
|
|
CONSTRAINT harvest_log_pk PRIMARY KEY (harvest_log_id)
|
66 |
2109
|
costa
|
);
|
67 |
|
|
|
68 |
|
|
/*
|
69 |
|
|
* harvest_detail_log -- table to log detailed info about documents that
|
70 |
|
|
* generated errors during the harvest
|
71 |
|
|
*/
|
72 |
|
|
CREATE TABLE harvest_detail_log (
|
73 |
|
|
detail_log_id INT8, -- unique id
|
74 |
|
|
harvest_log_id INT8, -- ponter to the related log entry
|
75 |
|
|
scope VARCHAR(50), -- document scope
|
76 |
|
|
identifier INT8, -- document identifier
|
77 |
|
|
revision INT8, -- document revision
|
78 |
|
|
document_url VARCHAR(255), -- document URL
|
79 |
|
|
error_message VARCHAR(1000), -- text error message
|
80 |
|
|
document_type VARCHAR(100), -- document type
|
81 |
|
|
CONSTRAINT harvest_detail_log_pk PRIMARY KEY (detail_log_id),
|
82 |
2112
|
costa
|
CONSTRAINT harvest_detail_log_fk
|
83 |
2109
|
costa
|
FOREIGN KEY (harvest_log_id) REFERENCES harvest_log
|
84 |
|
|
);
|