Project

General

Profile

metacat / src / upgrade-db-to-1.8-postgres.sql @ 8504

1
BEGIN;
2
ALTER TABLE xml_nodes  ADD COLUMN column_new TEXT;
3
UPDATE xml_nodes SET column_new = nodedata;
4
ALTER TABLE xml_nodes DROP COLUMN nodedata;
5
ALTER TABLE xml_nodes RENAME column_new TO nodedata;
6
COMMIT;
7

    
8
BEGIN;
9
ALTER TABLE xml_nodes_revisions ADD COLUMN column_new TEXT;
10
UPDATE xml_nodes_revisions SET column_new = nodedata;
11
ALTER TABLE xml_nodes_revisions DROP COLUMN nodedata;
12
ALTER TABLE xml_nodes_revisions RENAME column_new TO nodedata;
13
COMMIT;
14

    
15
BEGIN;
16
ALTER TABLE xml_queryresult ADD COLUMN column_new TEXT;
17
UPDATE xml_queryresult SET column_new = queryresult_string;
18
ALTER TABLE xml_queryresult DROP COLUMN queryresult_string;
19
ALTER TABLE xml_queryresult RENAME column_new TO queryresult_string;
20
COMMIT;
21

    
22
BEGIN;
23
ALTER TABLE xml_path_index ADD COLUMN column_new TEXT;
24
UPDATE xml_path_index SET column_new = nodedata;
25
ALTER TABLE xml_path_index DROP COLUMN nodedata;
26
ALTER TABLE xml_path_index RENAME column_new TO nodedata;
27
CREATE INDEX xml_path_index_idx2 ON xml_path_index (nodedata);
28
COMMIT;
29

    
30
BEGIN;
31
ALTER TABLE xml_index ADD COLUMN column_new TEXT;
32
UPDATE xml_index SET column_new = path;
33
ALTER TABLE xml_index DROP COLUMN path;
34
ALTER TABLE xml_index RENAME column_new TO path;
35
CREATE INDEX xml_index_idx1 ON xml_index (path);
36
COMMIT;
37

    
38

    
39
CREATE INDEX xml_index_idx2 ON xml_index (docid);
40
CREATE INDEX xml_nodes_idx4 ON xml_nodes (docid);
41
CREATE INDEX xml_documents_idx3 ON xml_documents (rootnodeid);
42
CREATE INDEX xml_index_idx3 ON xml_index (nodeid);