Project

General

Profile

« Previous | Next » 

Revision 2099

Added by Matt Jones about 20 years ago

Modified SQL scripts to add the new access_log table. I've partially tested this under postgres but have not yet tested under oracle.

View differences:

xmltables.sql
1
/*
2
 * xmltables.sql -- Create or replace tables for storing XML in the db
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *             National Center for Ecological Analysis and Synthesis
3 5
 *
4
 *      Purpose: creates tables needed for XML database
5
 * 
6
 *      Created: 12 September 1999
7
 *       Author: Matt Jones
8
 * Organization: National Center for Ecological Analysis and Synthesis
9
 *    Copyright: 2000 Regents of the University of California and the
10
 *               National Center for Ecological Analysis and Synthesis
11
 *  For Details: http://www.nceas.ucsb.edu/
12
 *    File Info: '$Id$'
6
 *   '$Author$'
7
 *     '$Date$'
8
 * '$Revision$'
13 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
14 23
 */
15 24

  
16 25
/*
......
26 35
DROP SEQUENCE accnum_uniqueid_seq;
27 36
DROP SEQUENCE xml_documents_id_seq;
28 37
DROP SEQUENCE accession_number_id_seq;
38
DROP SEQUENCE access_log_seq;
29 39
               
30 40
/* Drop triggers are not necessary */
31 41
DROP TRIGGER xml_nodes_before_insert;
......
34 44
DROP TRIGGER xml_relation_before_insert;
35 45
DROP TRIGGER xml_replication_before_insert;
36 46
DROP TRIGGER accession_number_before_insert;
47
DROP TRIGGER access_log_before_insert;
37 48

  
38 49
DROP TABLE xml_index;
39 50
DROP TABLE xml_access;
......
45 56
DROP TABLE xml_replication;
46 57
DROP TABLE xml_catalog;
47 58
DROP TABLE accession_number;
59
DROP TABLE access_log;
48 60

  
49 61
/*
50 62
 *Replication -- table to store servers that metacat is replicated to
......
310 322
		FOREIGN KEY (docid) REFERENCES xml_documents
311 323
);
312 324

  
325
/*
326
 * Logging -- table to store metadata and data access log
327
 */
328
CREATE TABLE access_log (
329
  entryid       NUMBER(20),     -- the identifier for the log event
330
  ip_address    VARCHAR2(512),  -- the ip address inititiating the event
331
  principal     VARCHAR2(512),  -- the user initiiating the event
332
  docid         VARCHAR2(250),	-- the document id #
333
  rev           NUMBER(10),     -- the revision number
334
  event         VARCHAR2(512),  -- the code symbolizing the event type
335
  date_logged   DATE,           -- the datetime on which the event occurred
336
  CONSTRAINT access_log_pk PRIMARY KEY (entryid)
337
);
338

  
339
CREATE SEQUENCE access_log_id_seq;
340
CREATE TRIGGER access_log_before_insert
341
BEFORE INSERT ON access_log FOR EACH ROW
342
BEGIN
343
  SELECT access_log_id_seq.nextval
344
    INTO :new.entryid
345
    FROM dual;
346
END;

Also available in: Unified diff