Project

General

Profile

1
/*
2
 * NOTE: Not restoring any documents that were archived by the CN
3
 * because we do not know of any Oracle-based MNs
4
 */
5

    
6
/* Ensure ALL previous revisions of docids 
7
 * that have been obsoleted_by something else
8
 * do not also have archived=true flag set
9
 * (Avoids encountering this issue again)
10
 */
11

    
12
/* Check the numbers in xml_revisions
13
 */
14
/*
15
SELECT count(id.guid)
16
FROM xml_revisions x,
17
	identifier id,
18
	systemMetadata sm
19
WHERE x.docid = id.docid
20
AND x.rev = id.rev
21
AND id.guid = sm.guid
22
AND sm.obsoleted_by IS NOT null
23
AND sm.archived = 'true';
24
*/
25

    
26
/*Do the update on xml_revisions
27
 */
28
UPDATE systemMetadata sm
29
SET archived = false
30
FROM xml_revisions x,
31
	identifier id
32
WHERE x.docid = id.docid
33
AND x.rev = id.rev
34
AND id.guid = sm.guid
35
AND sm.obsoleted_by IS NOT null
36
AND sm.archived = 'true';
37

    
38
/** 
39
 * Check numbers in xml_documents
40
 */
41
/*
42
SELECT count(id.guid)
43
FROM xml_documents x,
44
	identifier id,
45
	systemMetadata sm
46
WHERE x.docid = id.docid
47
AND x.rev = id.rev
48
AND id.guid = sm.guid
49
AND sm.obsoleted_by IS NOT null
50
AND sm.archived = 'true';
51
*/
52

    
53
/*Do the update on xml_documents
54
 */
55
UPDATE systemMetadata sm
56
SET archived = false
57
FROM xml_documents x,
58
	identifier id
59
WHERE x.docid = id.docid
60
AND x.rev = id.rev
61
AND id.guid = sm.guid
62
AND sm.obsoleted_by IS NOT null
63
AND sm.archived = 'true';
64

    
65
/* Register schemas
66
*/
67
DELETE FROM xml_catalog 
68
      WHERE entry_type LIKE 'Schema'
69
        AND system_id LIKE '%/dataone/%';
70
DELETE FROM xml_catalog 
71
      WHERE entry_type LIKE 'Schema'
72
        AND system_id LIKE '%/dc/%';
73
DELETE FROM xml_catalog 
74
      WHERE entry_type LIKE 'Schema'
75
        AND system_id LIKE '%/dwc/%';
76
DELETE FROM xml_catalog 
77
      WHERE entry_type LIKE 'Schema'
78
        AND system_id LIKE '%/dryad/%';                
79
INSERT INTO xml_catalog (entry_type, public_id, system_id)
80
  VALUES ('Schema', 'http://ns.dataone.org/service/types/v1', '/schema/dataone/dataoneTypes.xsd');
81
INSERT INTO xml_catalog (entry_type, public_id, system_id)
82
  VALUES ('Schema', 'http://ns.dataone.org/service/types/v1.1', '/schema/dataone/dataoneTypes_v1.1.xsd');
83
INSERT INTO xml_catalog (entry_type, public_id, system_id)
84
  VALUES ('Schema', 'http://purl.org/dryad/schema/terms/v3.1', '/schema/dryad/dryad.xsd');
85
INSERT INTO xml_catalog (entry_type, public_id, system_id)
86
  VALUES ('Schema', 'http://purl.org/dryad/schema/dryad-bibo/v3.1', '/schema/dryad/dryad-bibo.xsd');
87
INSERT INTO xml_catalog (entry_type, public_id, system_id)
88
  VALUES ('Schema', 'http://purl.org/dc/terms/', '/schema/dc/dcterms.xsd');
89
INSERT INTO xml_catalog (entry_type, public_id, system_id)
90
  VALUES ('Schema', 'http://purl.org/dc/elements/1.1/', '/schema/dc/dc.xsd');
91
INSERT INTO xml_catalog (entry_type, public_id, system_id)
92
  VALUES ('Schema', 'http://purl.org/dc/dcmitype/', '/schema/dc/dcmitype.xsd');
93
INSERT INTO xml_catalog (entry_type, public_id, system_id)
94
  VALUES ('Schema', 'http://rs.tdwg.org/dwc/terms/', '/schema/dwc/tdwg_dwcterms.xsd');
95

    
96
/*
97
 * update the database version
98
 */
99
UPDATE db_version SET status=0;
100

    
101
INSERT INTO db_version (version, status, date_created) 
102
  VALUES ('2.4.0', 1, CURRENT_DATE);
(84-84/89)