Revision 6949
Added by ben leinfelder almost 13 years ago
src/upgrade-db-to-2.0.0-oracle.sql | ||
---|---|---|
123 | 123 |
INSERT INTO max_identifier (docid, rev, guid) |
124 | 124 |
SELECT docid, MAX(rev), docid || '.' || MAX(rev) |
125 | 125 |
FROM identifier |
126 |
GROUP BY docid |
|
126 |
GROUP BY docid;
|
|
127 | 127 |
|
128 | 128 |
/** only need to join on docid since there is a single row for the max docid **/ |
129 | 129 |
UPDATE xml_access |
130 | 130 |
SET accessfileid = maxid.guid |
131 | 131 |
FROM max_identifier maxid, xml_access xa |
132 | 132 |
WHERE xa.accessfileid = maxid.docid |
133 |
AND xa.guid IS NOT null |
|
133 |
AND xa.guid IS NOT null;
|
|
134 | 134 |
|
135 | 135 |
DROP TABLE max_identifier; |
136 | 136 |
|
src/upgrade-db-to-2.0.0-postgres.sql | ||
---|---|---|
129 | 129 |
INSERT INTO max_identifier (docid, rev, guid) |
130 | 130 |
SELECT docid, MAX(rev), docid || '.' || MAX(rev) |
131 | 131 |
FROM identifier |
132 |
GROUP BY docid |
|
132 |
GROUP BY docid;
|
|
133 | 133 |
|
134 | 134 |
/** only need to join on docid since there is a single row for the max docid **/ |
135 | 135 |
UPDATE xml_access |
136 | 136 |
SET accessfileid = maxid.guid |
137 | 137 |
FROM max_identifier maxid, xml_access xa |
138 | 138 |
WHERE xa.accessfileid = maxid.docid |
139 |
AND xa.guid IS NOT null |
|
139 |
AND xa.guid IS NOT null;
|
|
140 | 140 |
|
141 | 141 |
DROP TABLE max_identifier; |
142 | 142 |
|
Also available in: Unified diff
semicolons!