Project

General

Profile

1
CREATE TABLE systemMetadata (
2
   guid   VARCHAR2(2000),    -- the globally unique string identifier
3
   serial_version VARCHAR2(256), --the serial version of the object
4
   date_uploaded DATE, -- the date/time the document was first submitted
5
   rights_holder VARCHAR2(250), --the user who has rights to the document, usually the first persons to upload it
6
   checksum VARCHAR2(512), --the checksum of the doc using the given algorithm (see below)
7
   checksum_algorithm VARCHAR2(250), --the algorithm used to calculate the checksum
8
   origin_member_node VARCHAR2(250), --the member node where the document was first uploaded
9
   authoritive_member_node VARCHAR2(250), --the member node that currently controls the document
10
   date_modified DATE, -- the last date/time that the file was changed
11
   submitter VARCHAR2(256), -- the user who originally submitted the doc
12
   object_format VARCHAR2(256), --the format of the object
13
   size VARCHAR2(256), --the size of the object
14
   replication_allowed boolean,	 -- replication allowed
15
   number_replicas NUMBER(8), 	-- the number of replicas allowed
16
   obsoletes   VARCHAR2(2000),    -- the identifier of the record that this replaces
17
   obsoleted_by   VARCHAR2(2000),    -- the identifier of the record that replaces this record
18
   CONSTRAINT systemMetadata_pk 
19
		PRIMARY KEY (guid)
20
)
21

    
22
CREATE TABLE systemMetadataReplicationPolicy (
23
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
24
	member_node VARCHAR(250),	 -- replication member node
25
	policy VARCHAR2(2000),	 -- the policy (preferred, blocked, etc...TBD)
26
	CONSTRAINT systemMetadataReplicationPolicy_fk 
27
		FOREIGN KEY (guid) REFERENCES systemMetadata
28
);
29

    
30
CREATE TABLE systemMetadataReplicationStatus (
31
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
32
	member_node VARCHAR(250),	 -- replication member node
33
	status VARCHAR(250),	 -- replication status
34
	date_verified DATE, 	-- the date replication was verified   
35
	CONSTRAINT systemMetadataReplicationStatus_fk 
36
		FOREIGN KEY (guid) REFERENCES systemMetadata
37
);
38

    
39
DROP TABLE identifier;
40

    
41
CREATE TABLE identifier (
42
   guid   VARCHAR2(2000), -- the globally unique string identifier
43
   docid  VARCHAR2(250),  -- the local document id #
44
   rev    NUMBER(8)       -- the revision part of the local identifier
45
);
46

    
47
/*
48
 * Replication changes to support DataONE System Metadata replication
49
 */
50
ALTER TABLE xml_replication ADD COLUMN systemmetadatareplicate NUMBER(1);
51
/*
52
 *  Allow guid in xml_access table (for system metadata)
53
*/
54
ALTER TABLE xml_access ADD COLUMN guid VARCHAR2(2000);
55

    
56
/**
57
 * track the user-agent for the request
58
 */
59
ALTER TABLE access_log ADD COLUMN user_agent VARCHAR2(512);
60

    
61
/*
62
 * add the nodedatadate column to xml_nodes 
63
 * TODO: load the data into it (java?)
64
 */
65
ALTER TABLE xml_nodes ADD COLUMN nodedatadate TIMESTAMP;
66
ALTER TABLE xml_nodes_revisions ADD COLUMN nodedatadate TIMESTAMP;
67
ALTER TABLE xml_path_index ADD COLUMN nodedatadate TIMESTAMP;
68
CREATE INDEX xml_path_index_idx4 ON xml_path_index (nodedatadate);
69

    
70
/*
71
 * Register the new schema
72
 */
73
INSERT INTO xml_catalog (entry_type, public_id, system_id)
74
  VALUES ('Schema', '@eml2_1_1namespace@', '/schema/eml-2.1.1/eml.xsd');
75

    
76
/*
77
 * update the database version
78
 */
79
UPDATE db_version SET status=0;
80

    
81
INSERT INTO db_version (version, status, date_created) 
82
  VALUES ('2.0.0', 1, CURRENT_DATE);
(48-48/53)