Revision 8572
Added by ben leinfelder almost 11 years ago
src/upgrade-db-to-2.4.0-postgres.sql | ||
---|---|---|
5 | 5 |
/* Gather most recent docids from xml_revisions that |
6 | 6 |
* 1. do not have systemMetadata.archived=true |
7 | 7 |
* 2. do not exist in xml_documents |
8 |
* TODO: hone the criteria for selecting documents to restore |
|
8 | 9 |
* */ |
9 | 10 |
CREATE TABLE restore_documents ( |
10 | 11 |
docid VARCHAR(250), |
... | ... | |
30 | 31 |
WHERE x.docid = id.docid |
31 | 32 |
AND x.rev = id.rev |
32 | 33 |
AND id.guid = sm.guid |
33 |
-- TODO: hone the criteria for selecting documents to restore |
|
34 | 34 |
AND sm.archived = true |
35 |
AND sm.obsoletedBy is not null; |
|
35 |
AND sm.obsoleted_by is not null |
|
36 |
AND NOT EXISTS (SELECT * from xml_documents xd WHERE x.docid = xd.docid) |
|
37 |
ORDER BY id.guid; |
|
36 | 38 |
|
37 | 39 |
/* Move xml_revisions back into xml_documents for the affected docids |
38 | 40 |
*/ |
Also available in: Unified diff
correct syntax - add more criteria for selecting documents.