Changeset 3843


Ignore:
Timestamp:
02/05/08 11:23:11 (11 years ago)
Author:
cbyrom
Message:

Add filename column back into original_document + adjust trigger procedure
to ignore audit copies when only harvest count has been incremented.

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  
    88CREATE FUNCTION add_document_to_history() RETURNS OPAQUE AS ' 
    99    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; 
    1517                RETURN NEW; 
    1618     END; 
  • TI01-discovery/branches/ingestAutomation-upgrade/database/original_document.sql

    r3834 r3843  
    88CREATE TABLE original_document ( 
    99        original_document_id SERIAL primary key, 
     10                original_document_filename varchar(255), 
    1011                discovery_id    varchar(255) unique, 
    1112                original_format text, 
     
    2021-- create the mirror table for this table - to store audit histories 
    2122DROP TABLE original_document_history CASCADE; 
    22 COMMIT; 
    2323SELECT * INTO original_document_history FROM original_document;  
    2424 
     
    2929                FOR EACH ROW EXECUTE PROCEDURE add_document_to_history(); 
    3030 
    31 INSERT INTO original_document VALUES (DEFAULT, 'test_dummy', 'DIF', null, null, current_date, null, 1, 1); 
    32 INSERT INTO original_document VALUES (DEFAULT, 'test_record', 'DIF', '<?xml version="1.0" encoding="utf-8"?> 
     31INSERT INTO original_document VALUES (DEFAULT, 'tst.xml', 'test_dummy', 'DIF', null, null, current_date, null, 1, 1); 
     32INSERT INTO original_document VALUES (DEFAULT, 'tst1.xml', 'test_record', 'DIF', '<?xml version="1.0" encoding="utf-8"?> 
    3333<kml xmlns="http://earth.google.com/kml/2.2"> 
    3434  <Folder> 
     
    5454null, current_date, null, 1, 1); 
    5555 
    56 INSERT INTO original_document VALUES (DEFAULT, 'test_dummy1', 'DIF', 'freds freds bloo' , null, current_date, null, 1, 1); 
    57 INSERT INTO original_document VALUES (DEFAULT, 'test_dummy2', null, 'fred fred bloo fred', null, current_date, null, 1, 1); 
    58 INSERT INTO original_document VALUES (DEFAULT, 'test_dummy3', null, 'fred fred bloo, fred, fred, fred, fre, fred', null, current_date, null, 1, 1); 
     56INSERT INTO original_document VALUES (DEFAULT, 'tst2.xml', 'test_dummy1', 'DIF', 'freds freds bloo' , null, current_date, null, 1, 1); 
     57INSERT INTO original_document VALUES (DEFAULT, 'tst3.xml', 'test_dummy2', null, 'fred fred bloo fred', null, current_date, null, 1, 1); 
     58INSERT INTO original_document VALUES (DEFAULT, 'tst4.xml', 'test_dummy3', null, 'fred fred bloo, fred, fred, fred, fre, fred', null, current_date, null, 1, 1); 
    5959 
    6060UPDATE original_document SET ts_vector = to_tsvector('english', original_document); 
Note: See TracChangeset for help on using the changeset viewer.