Project

General

Profile

1 5371 berkley
CREATE TABLE systemMetadata (
2
   guid   VARCHAR2(2000),    -- the globally unique string identifier
3 5887 berkley
   date_uploaded DATE, -- the date/time the document was first submitted
4
   rights_holder VARCHAR2(250), --the user who has rights to the document, usually the first persons to upload it
5
   checksum VARCHAR2(512), --the checksum of the doc using the given algorithm (see below)
6
   checksum_algorithm VARCHAR2(250), --the algorithm used to calculate the checksum
7
   origin_member_node VARCHAR2(250), --the member node where the document was first uploaded
8
   authoritive_member_node VARCHAR2(250), --the member node that currently controls the document
9
   date_modified DATE, -- the last date/time that the file was changed
10 5917 berkley
   submitter VARCHAR2(256), -- the user who originally submitted the doc
11
   object_format VARCHAR2(256), --the format of the object
12 6136 leinfelder
   size VARCHAR2(256), --the size of the object
13
   replication_allowed boolean,	 -- replication allowed
14
   number_replicas NUMBER(8), 	-- the number of replicas allowed
15 6375 leinfelder
   obsoletes   VARCHAR2(2000),    -- the identifier of the record that this replaces
16
   obsoleted_by   VARCHAR2(2000),    -- the identifier of the record that replaces this record
17 6136 leinfelder
   CONSTRAINT systemMetadata_pk
18
		PRIMARY KEY (guid)
19 5371 berkley
)
20
21 6136 leinfelder
CREATE TABLE systemMetadataReplicationPolicy (
22
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
23
	member_node VARCHAR(250),	 -- replication member node
24
	policy VARCHAR2(2000),	 -- the policy (preferred, blocked, etc...TBD)
25
	CONSTRAINT systemMetadataReplicationPolicy_fk
26
		FOREIGN KEY (guid) REFERENCES systemMetadata
27
);
28
29
CREATE TABLE systemMetadataReplicationStatus (
30
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
31
	member_node VARCHAR(250),	 -- replication member node
32
	status VARCHAR(250),	 -- replication status
33
	date_verified DATE, 	-- the date replication was verified
34
	CONSTRAINT systemMetadataReplicationStatus_fk
35
		FOREIGN KEY (guid) REFERENCES systemMetadata
36
);
37
38 5276 jones
CREATE TABLE identifier (
39
   guid   VARCHAR2(2000), -- the globally unique string identifier
40
   docid  VARCHAR2(250),  -- the local document id #
41
   rev    NUMBER(8)       -- the revision part of the local identifier
42
);
43
44
/*
45 6136 leinfelder
 * Replication changes to support DataONE System Metadata replication
46
 */
47
ALTER TABLE xml_replication ADD COLUMN systemmetadatareplicate NUMBER(1);
48
/*
49
 *  Allow guid in xml_access table (for system metadata)
50
*/
51
ALTER TABLE xml_access ADD COLUMN guid VARCHAR2(2000);
52
53
/*
54 6012 leinfelder
 * add the nodedatadate column to xml_nodes
55
 * TODO: load the data into it (java?)
56
 */
57
ALTER TABLE xml_nodes ADD COLUMN nodedatadate TIMESTAMP;
58
ALTER TABLE xml_nodes_revisions ADD COLUMN nodedatadate TIMESTAMP;
59
ALTER TABLE xml_path_index ADD COLUMN nodedatadate TIMESTAMP;
60
CREATE INDEX xml_path_index_idx4 ON xml_path_index (nodedatadate);
61
62
63
/*
64 5400 jones
 * Register the DataONE schemas
65
 */
66
INSERT INTO xml_catalog (entry_type, public_id, system_id)
67 5657 berkley
  VALUES ('Schema', 'http://dataone.org/service/types/0.5.1', '/schema/D1_SCHEMA_0_5_1/dataoneTypes.xsd');
68 5709 leinfelder
INSERT INTO xml_catalog (entry_type, public_id, system_id)
69 6092 jones
  VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.1', '/schema/D1_SCHEMA_0_6_1/dataoneTypes.xsd');
70
INSERT INTO xml_catalog (entry_type, public_id, system_id)
71
  VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.2', '/schema/D1_SCHEMA_0_6_2/dataoneTypes.xsd');
72
73
INSERT INTO xml_catalog (entry_type, public_id, system_id)
74 5709 leinfelder
  VALUES ('Schema', '@eml2_1_1namespace@', '/schema/eml-2.1.1/eml.xsd');
75
76 5400 jones
/*
77 5276 jones
 * update the database version
78
 */
79
UPDATE db_version SET status=0;
80
81
INSERT INTO db_version (version, status, date_created)
82
  VALUES ('1.10.0', 1, CURRENT_DATE);