Project

General

Profile

1 8555 leinfelder
/*
2 8607 leinfelder
 * NOTE: Not restoring any documents that were archived by the CN
3
 * because we do not know of any Oracle-based MNs
4 8600 leinfelder
 */
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 8607 leinfelder
/* Check the numbers in xml_revisions
13 8600 leinfelder
 */
14 8607 leinfelder
/*
15 8600 leinfelder
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 8607 leinfelder
AND sm.archived = 'true';
24
*/
25 8600 leinfelder
26 8607 leinfelder
/*Do the update on xml_revisions
27 8600 leinfelder
 */
28
UPDATE systemMetadata sm
29 8607 leinfelder
SET archived = false
30 8600 leinfelder
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 8607 leinfelder
AND sm.archived = 'true';
37 8600 leinfelder
38 8607 leinfelder
/**
39
 * Check numbers in xml_documents
40
 */
41 8600 leinfelder
/*
42 8607 leinfelder
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
/*
66 8555 leinfelder
 * update the database version
67
 */
68
UPDATE db_version SET status=0;
69
70
INSERT INTO db_version (version, status, date_created)
71
  VALUES ('2.4.0', 1, CURRENT_DATE);