Project

General

Profile

1
/*
2
 * upgrade-db-to-1.3-oracle.sql -- Add three columns to xml_access tables
3
 * in Production Metacat
4
 *
5
 *      Created: 07/14/2002
6
 *       Author: Jing Tao
7
 * Organization: National Center for Ecological Analysis and Synthesis
8
 *    Copyright: 2000 Regents of the University of California and the
9
 *               National Center for Ecological Analysis and Synthesis
10
 *  For Details: http://www.nceas.ucsb.edu/
11
 *    File Info: '$Id: upgrade-db-to-1.3-oracle.sql 4104 2008-07-11 17:04:49Z daigle $'
12
 *
13
 */
14

    
15

    
16
/*
17
 * Add three columns to xml_access
18
 */
19
ALTER TABLE xml_access ADD (subtreeid VARCHAR2(32), startnodeid NUMBER(20), endnodeid NUMBER(20) );
20

    
21
/*
22
 * accesssubtree -- table to store access subtree info
23
 */
24
CREATE TABLE xml_accesssubtree (
25
	docid		VARCHAR2(250),	-- the document id #
26
  rev 		NUMBER(10) DEFAULT 1, --the revision number of the docume
27
  controllevel VARCHAR2(50), -- the level it control -- document or subtree
28
  subtreeid VARCHAR2(250), -- the subtree id 
29
	startnodeid	NUMBER(20),	-- the start node id of access subtree
30
  endnodeid NUMBER(20), -- the end node if of access subtree
31
  CONSTRAINT xml_accesssubtree_docid_fk 
32
		FOREIGN KEY (docid) REFERENCES xml_documents
33
);
34

    
35
/*
36
 * Drop the constrain in xml_relation table for (subject, relationship, object)
37
 * Add the new constrain in xml_relation table for (docid, subject, relationship, object)
38
 */
39
ALTER TABLE xml_relation DROP CONSTRAINT xml_relation_uk;
40
ALTER TABLE xml_relation ADD  CONSTRAINT xml_relation_uk UNIQUE (docid, subject, relationship, object); 
(24-24/46)