Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *             National Center for Ecological Analysis and Synthesis
5
 *
6
 *   '$Author: costa $'
7
 *     '$Date: 2004-04-06 15:11:06 -0700 (Tue, 06 Apr 2004) $'
8
 * '$Revision: 2109 $'
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
 *Logging -- table to store metadata and data access log
27
 */
28
CREATE SEQUENCE access_log_id_seq;
29
CREATE TABLE access_log (
30
  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
  docid         VARCHAR(250),	-- the document id #
34
  event         VARCHAR(512),   -- the code symbolizing the event type
35
  date_logged   TIMESTAMP,      -- the datetime on which the event occurred
36
  CONSTRAINT access_log_pk PRIMARY KEY (entryid)
37
);
38

    
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
  site_schedule_id       INT8,          -- foreign key
65
  CONSTRAINT harvest_log_pk PRIMARY KEY (harvest_log_id),
66
  CONSTRAINT harvest_log_site_schedule_id_fk 
67
        FOREIGN KEY (site_schedule_id) REFERENCES harvest_site_schedule
68
);
69

    
70
/* 
71
 * harvest_detail_log -- table to log detailed info about documents that
72
 *                       generated errors during the harvest
73
 */
74
CREATE TABLE harvest_detail_log (
75
  detail_log_id          INT8,          -- unique id
76
  harvest_log_id         INT8,          -- ponter to the related log entry
77
  scope                  VARCHAR(50),   -- document scope
78
  identifier             INT8,          -- document identifier
79
  revision               INT8,          -- document revision
80
  document_url           VARCHAR(255), -- document URL
81
  error_message          VARCHAR(1000), -- text error message
82
  document_type          VARCHAR(100),  -- document type
83
  CONSTRAINT harvest_detail_log_pk PRIMARY KEY (detail_log_id),
84
  CONSTRAINT harvest_detail_log_harvest_log_id_fk 
85
        FOREIGN KEY (harvest_log_id) REFERENCES harvest_log
86
);
87

    
(17-17/21)