Revision 2514
Added by sgarg over 19 years ago
xmltables-postgres.sql | ||
---|---|---|
155 | 155 |
CONSTRAINT xml_revisions_rep_fk |
156 | 156 |
FOREIGN KEY (server_location) REFERENCES xml_replication, |
157 | 157 |
CONSTRAINT xml_revisions_root_fk |
158 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes, |
|
158 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes_revisions,
|
|
159 | 159 |
CONSTRAINT xml_revisions_catalog_fk |
160 | 160 |
FOREIGN KEY (catalog_id) REFERENCES xml_catalog |
161 | 161 |
); |
... | ... | |
292 | 292 |
CONSTRAINT access_log_pk PRIMARY KEY (entryid) |
293 | 293 |
); |
294 | 294 |
|
295 |
|
|
295 | 296 |
/* |
297 |
* Table for indexing the paths specified the administrator in metacat.properties |
|
298 |
*/ |
|
299 |
|
|
300 |
CREATE SEQUENCE xml_path_index_id_seq; |
|
301 |
CREATE TABLE xml_path_index ( |
|
302 |
nodeid INT8 default nextval('xml_path_index_id_seq'), |
|
303 |
docid VARCHAR(250), -- the document id |
|
304 |
path VARCHAR(1000), -- precomputed path through tree |
|
305 |
nodedata VARCHAR(4000), -- the data for this node (e.g., |
|
306 |
-- for TEXT it is the content) |
|
307 |
nodedatanumerical FLOAT8, -- the data for this node if |
|
308 |
-- if it is a number |
|
309 |
parentnodeid INT8, -- id of the parent of the node represented |
|
310 |
-- by this row |
|
311 |
CONSTRAINT xml_path_index_pk PRIMARY KEY (nodeid), |
|
312 |
CONSTRAINT xml_path_index_upper_docid_fk |
|
313 |
FOREIGN KEY (docid) REFERENCES xml_documents |
|
314 |
); |
|
315 |
|
|
316 |
/* |
|
317 |
* Indexes of path, nodedata and nodedatanumerical in xml_path_index |
|
318 |
*/ |
|
319 |
CREATE INDEX xml_path_index_idx1 ON xml_path_index (path); |
|
320 |
CREATE INDEX xml_path_index_idx2 ON xml_path_index (nodedata); |
|
321 |
CREATE INDEX xml_path_index_idx3 ON xml_path_index (nodedatanumerical); |
|
322 |
|
|
323 |
|
|
324 |
/* |
|
325 |
* Table for storing the nodes for the old revisions of the document and the deleted documents |
|
326 |
*/ |
|
327 |
CREATE TABLE xml_nodes_revisions ( |
|
328 |
nodeid INT8, -- the unique node id (pk) |
|
329 |
nodeindex INT8, -- order of nodes within parent |
|
330 |
nodetype VARCHAR(20), -- type (DOCUMENT, COMMENT, PI, |
|
331 |
-- ELEMENT, ATTRIBUTE, TEXT) |
|
332 |
nodename VARCHAR(250), -- the name of an element or attribute |
|
333 |
nodeprefix VARCHAR(50), -- the namespace prefix of the node |
|
334 |
nodedata VARCHAR(4000), -- the data for this node (e.g., |
|
335 |
-- for TEXT it is the content) |
|
336 |
parentnodeid INT8, -- index of the parent of this node |
|
337 |
rootnodeid INT8, -- index of the root node of this tree |
|
338 |
docid VARCHAR(250), -- index to the document id |
|
339 |
date_created DATE, |
|
340 |
date_updated DATE, |
|
341 |
nodedatanumerical FLOAT8, -- the data for this node if |
|
342 |
-- if it is a number |
|
343 |
CONSTRAINT xml_nodes_revisions_pk PRIMARY KEY (nodeid), |
|
344 |
CONSTRAINT xml_nodes_revisions_root_fk |
|
345 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes_revisions, |
|
346 |
CONSTRAINT xml_nodes_revisions_parent_fk |
|
347 |
FOREIGN KEY (parentnodeid) REFERENCES xml_nodes_revisions |
|
348 |
); |
|
349 |
|
|
350 |
/* |
|
351 |
* Indexes of rootnodeid, parentnodeid, and nodename in xml_nodes_revisions |
|
352 |
*/ |
|
353 |
CREATE INDEX xml_nodes_revision_idx1 ON xml_nodes_revisions (rootnodeid); |
|
354 |
CREATE INDEX xml_nodes_revision_idx2 ON xml_nodes_revisions (parentnodeid); |
|
355 |
CREATE INDEX xml_nodes_revision_idx3 ON xml_nodes_revisions (nodename); |
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
|
360 |
/* |
|
296 | 361 |
* harvest_site_schedule -- table to store harvest sites and schedule info |
297 | 362 |
*/ |
298 | 363 |
CREATE TABLE harvest_site_schedule ( |
... | ... | |
339 | 404 |
FOREIGN KEY (harvest_log_id) REFERENCES harvest_log |
340 | 405 |
); |
341 | 406 |
|
407 |
|
Also available in: Unified diff
Modified postgres script so that:
1. Foreign key for rootnodeid in xml_revision points to xml_node_revision table instead of xml_nodes
2. Added a new table xml_path_index which is used to index the paths specified by user in metacat.properties
3. Addes a new table xml_nodes_revision which stores the nodes of old revisions and deleted documents
See bugs # 2152 and 2154