Project

General

Profile

« Previous | Next » 

Revision 6760

include revision clause when updating the accessfileid on the xml_acccess table

View differences:

src/upgrade-db-to-2.0.0-postgres.sql
82 82
	SELECT docid, revisionid, docid || '.' || revisionid FROM xml_revisions;
83 83

  
84 84
/**
85
 *  Allow guid in xml_access table (for system metadata)
85
 *  Add guid in xml_access table
86 86
 */
87 87
ALTER TABLE xml_access ADD COLUMN guid text;
88 88

  
89 89
/**
90 90
 * Upgrade xml_access records to use GUID from identifier table
91
 * NOTE: This duplicates existing access rules for every revision of a document
91 92
 */
92 93
INSERT INTO xml_access (
93 94
	guid, principal_name, permission, perm_type, perm_order, 
......
100 101
	WHERE id.docid = xa.docid;
101 102

  
102 103
/**
103
 * Include inline access rows -- they have a special guid: 'scope.docid.rev.index'
104
 * Include inline data access rows -- they have a special guid: 'scope.docid.rev.index'
104 105
 */
105 106
INSERT INTO xml_access (
106 107
	guid, principal_name, permission, perm_type, perm_order, 
......
114 115

  
115 116
/**
116 117
 * Update the accessfileid to use guid
117
 * TODO: specific revision should be used
118
 * NOTE: uses the last revision's guid as the new accessfileid
118 119
 */
119 120
UPDATE xml_access
120 121
SET accessfileid = id.guid
121 122
FROM identifier id, xml_access xa
122 123
WHERE xa.accessfileid = id.docid
124
AND id.rev = 
125
	(SELECT MAX(id2.rev) FROM identifier id2 WHERE id.docid = id2.docid)
123 126

  
124

  
125 127
/**
126 128
 * Remove old access rules
127 129
 */

Also available in: Unified diff