Revision 4414
Added by daigle about 16 years ago
src/upgrade-db-to-1.6-oracle.sql | ||
---|---|---|
212 | 212 |
/** copy nodes from xml_nodes_2 to xml_nodes */ |
213 | 213 |
INSERT INTO xml_nodes (nodeid, nodeindex, nodetype, nodename, nodeprefix, nodedata, parentnodeid, rootnodeid, docid, date_created, date_updated, nodedatanumerical) SELECT n.nodeid, n.nodeindex, n.nodetype, n.nodename, n.nodeprefix, n.nodedata, n.parentnodeid, n.rootnodeid, n.docid, n.date_created, n.date_updated, n.nodedatanumerical FROM xml_nodes_2 n, xml_nodes_revisions r WHERE n.rootnodeid = r.rootnodeid(+) AND r.rootnodeid is NULL; |
214 | 214 |
|
215 |
|
|
216 | 215 |
/** Drop old indexes **/ |
217 | 216 |
DROP INDEX xml_nodes_idx1; |
218 | 217 |
DROP INDEX xml_nodes_idx2; |
... | ... | |
223 | 222 |
CREATE INDEX xml_nodes_idx2 ON xml_nodes (parentnodeid); |
224 | 223 |
CREATE INDEX xml_nodes_idx3 ON xml_nodes (nodename); |
225 | 224 |
|
225 |
|
|
226 |
/** Re-add trigger to xml_node **/ |
|
227 |
DROP TRIGGER xml_nodes_before_insert; |
|
228 |
CREATE TRIGGER xml_nodes_before_insert |
|
229 |
BEFORE INSERT ON xml_nodes FOR EACH ROW |
|
230 |
BEGIN |
|
231 |
SELECT xml_nodes_id_seq.nextval |
|
232 |
INTO :new.nodeid |
|
233 |
FROM dual; |
|
234 |
END; |
|
235 |
/ |
|
236 |
|
|
226 | 237 |
/** Add constaints which were deleted before moving xml_nodes to xml_nodes_2 */ |
227 | 238 |
ALTER TABLE xml_documents ADD CONSTRAINT xml_documents_root_fk FOREIGN KEY (rootnodeid) REFERENCES xml_nodes; |
228 | 239 |
ALTER TABLE xml_index ADD CONSTRAINT xml_index_nodeid_fk FOREIGN KEY (nodeid) REFERENCES xml_nodes; |
Also available in: Unified diff
Re-add the xml_node id trigger. In oracle, this gets blown away when we switch tables.