Project

General

Profile

« Previous | Next » 

Revision 7372

include missing identifier mappings during 2.0.4 upgrade (mappings may be missing due to previous replication between servers that do not house SystemMetadata)

View differences:

src/upgrade-db-to-2.0.4-oracle.sql
1 1
/*
2
 * Include any identifier rows that may have been missed during replication
3
 * Previous 2.0.x versions were unable to make a guid-docid mapping when the 
4
 * source replication partner did not provide SystemMetadata. 
5
 * v2.0.4 fixes this short coming, but we need to make sure we have all the mappings.
6
 */
7

  
8
INSERT INTO identifier (docid, rev, guid) 
9
	SELECT docid, rev, docid || '.' || rev 
10
	FROM xml_documents x
11
	WHERE NOT EXISTS (SELECT guid FROM identifier i WHERE x.docid = i.docid AND x.rev = i.rev)
12
	UNION	
13
	SELECT docid, rev, docid || '.' || rev 
14
	FROM xml_revisions x
15
	WHERE NOT EXISTS (SELECT guid FROM identifier i WHERE x.docid = i.docid AND x.rev = i.rev);
16

  
17
/*
2 18
 * update the database version
3 19
 */
4 20
UPDATE db_version SET status=0;
src/upgrade-db-to-2.0.4-postgres.sql
1 1
/*
2
 * Include any identifier rows that may have been missed during replication
3
 * Previous 2.0.x versions were unable to make a guid-docid mapping when the 
4
 * source replication partner did not provide SystemMetadata. 
5
 * v2.0.4 fixes this short coming, but we need to make sure we have all the mappings.
6
 */
7

  
8
INSERT INTO identifier (docid, rev, guid) 
9
	SELECT docid, rev, docid || '.' || rev 
10
	FROM xml_documents x
11
	WHERE NOT EXISTS (SELECT guid FROM identifier i WHERE x.docid = i.docid AND x.rev = i.rev)
12
	UNION	
13
	SELECT docid, rev, docid || '.' || rev 
14
	FROM xml_revisions x
15
	WHERE NOT EXISTS (SELECT guid FROM identifier i WHERE x.docid = i.docid AND x.rev = i.rev);
16

  
17
/*
2 18
 * update the database version
3 19
 */
4 20
UPDATE db_version SET status=0;

Also available in: Unified diff