Changeset 3843 for TI01-discovery
- Timestamp:
- 02/05/08 11:23:11 (13 years ago)
- Location:
- TI01-discovery/branches/ingestAutomation-upgrade/database
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI01-discovery/branches/ingestAutomation-upgrade/database/ingest_procedures.sql
r3834 r3843 8 8 CREATE FUNCTION add_document_to_history() RETURNS OPAQUE AS ' 9 9 BEGIN 10 -- This inserts the currently stored information 11 -- into the original_document_history table 12 INSERT INTO original_document_history 13 SELECT * FROM original_document WHERE original_document_id=NEW.original_document_id; 14 10 -- This inserts the currently stored information 11 -- into the original_document_history table 12 -- NB, only do this when we are not just incrementing the harvest count 13 IF OLD.harvest_count=NEW.harvest_count THEN 14 INSERT INTO original_document_history 15 SELECT * FROM original_document WHERE original_document_id=NEW.original_document_id; 16 END IF; 15 17 RETURN NEW; 16 18 END; -
TI01-discovery/branches/ingestAutomation-upgrade/database/original_document.sql
r3834 r3843 8 8 CREATE TABLE original_document ( 9 9 original_document_id SERIAL primary key, 10 original_document_filename varchar(255), 10 11 discovery_id varchar(255) unique, 11 12 original_format text, … … 20 21 -- create the mirror table for this table - to store audit histories 21 22 DROP TABLE original_document_history CASCADE; 22 COMMIT;23 23 SELECT * INTO original_document_history FROM original_document; 24 24 … … 29 29 FOR EACH ROW EXECUTE PROCEDURE add_document_to_history(); 30 30 31 INSERT INTO original_document VALUES (DEFAULT, 't est_dummy', 'DIF', null, null, current_date, null, 1, 1);32 INSERT INTO original_document VALUES (DEFAULT, 't est_record', 'DIF', '<?xml version="1.0" encoding="utf-8"?>31 INSERT INTO original_document VALUES (DEFAULT, 'tst.xml', 'test_dummy', 'DIF', null, null, current_date, null, 1, 1); 32 INSERT INTO original_document VALUES (DEFAULT, 'tst1.xml', 'test_record', 'DIF', '<?xml version="1.0" encoding="utf-8"?> 33 33 <kml xmlns="http://earth.google.com/kml/2.2"> 34 34 <Folder> … … 54 54 null, current_date, null, 1, 1); 55 55 56 INSERT INTO original_document VALUES (DEFAULT, 't est_dummy1', 'DIF', 'freds freds bloo' , null, current_date, null, 1, 1);57 INSERT INTO original_document VALUES (DEFAULT, 't est_dummy2', null, 'fred fred bloo fred', null, current_date, null, 1, 1);58 INSERT INTO original_document VALUES (DEFAULT, 't est_dummy3', null, 'fred fred bloo, fred, fred, fred, fre, fred', null, current_date, null, 1, 1);56 INSERT INTO original_document VALUES (DEFAULT, 'tst2.xml', 'test_dummy1', 'DIF', 'freds freds bloo' , null, current_date, null, 1, 1); 57 INSERT INTO original_document VALUES (DEFAULT, 'tst3.xml', 'test_dummy2', null, 'fred fred bloo fred', null, current_date, null, 1, 1); 58 INSERT INTO original_document VALUES (DEFAULT, 'tst4.xml', 'test_dummy3', null, 'fred fred bloo, fred, fred, fred, fre, fred', null, current_date, null, 1, 1); 59 59 60 60 UPDATE original_document SET ts_vector = to_tsvector('english', original_document);
Note: See TracChangeset
for help on using the changeset viewer.