Revision 8607
Added by ben leinfelder almost 11 years ago
src/upgrade-db-to-2.4.0-oracle.sql | ||
---|---|---|
1 | 1 |
/* |
2 |
* TODO: restore any documents that were archived by the CN |
|
2 |
* NOTE: Not restoring any documents that were archived by the CN |
|
3 |
* because we do not know of any Oracle-based MNs |
|
3 | 4 |
*/ |
4 | 5 |
|
5 |
|
|
6 | 6 |
/* Ensure ALL previous revisions of docids |
7 | 7 |
* that have been obsoleted_by something else |
8 |
* but still have current revisions |
|
9 | 8 |
* do not also have archived=true flag set |
10 | 9 |
* (Avoids encountering this issue again) |
11 | 10 |
*/ |
12 | 11 |
|
13 |
/* Check the numbers |
|
12 |
/* Check the numbers in xml_revisions
|
|
14 | 13 |
*/ |
14 |
/* |
|
15 | 15 |
SELECT count(id.guid) |
16 | 16 |
FROM xml_revisions x, |
17 | 17 |
identifier id, |
... | ... | |
20 | 20 |
AND x.rev = id.rev |
21 | 21 |
AND id.guid = sm.guid |
22 | 22 |
AND sm.obsoleted_by IS NOT null |
23 |
AND sm.archived = 'true' |
|
24 |
AND EXISTS (SELECT * from xml_documents xd WHERE xd.docid = x.docid);
|
|
23 |
AND sm.archived = 'true';
|
|
24 |
*/
|
|
25 | 25 |
|
26 |
/*Do the update |
|
26 |
/*Do the update on xml_revisions
|
|
27 | 27 |
*/ |
28 | 28 |
UPDATE systemMetadata sm |
29 |
SET sm.archived = false
|
|
29 |
SET archived = false |
|
30 | 30 |
FROM xml_revisions x, |
31 | 31 |
identifier id |
32 | 32 |
WHERE x.docid = id.docid |
33 | 33 |
AND x.rev = id.rev |
34 | 34 |
AND id.guid = sm.guid |
35 | 35 |
AND sm.obsoleted_by IS NOT null |
36 |
AND sm.archived = 'true' |
|
37 |
AND EXISTS (SELECT * from xml_documents xd WHERE xd.docid = x.docid); |
|
36 |
AND sm.archived = 'true'; |
|
38 | 37 |
|
38 |
/** |
|
39 |
* Check numbers in xml_documents |
|
40 |
*/ |
|
39 | 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 |
/* |
|
40 | 66 |
* update the database version |
41 | 67 |
*/ |
42 | 68 |
UPDATE db_version SET status=0; |
Also available in: Unified diff
move the postgres changes to the oracle version -- update note about not attempting to restore because no Oracle MNs exist.