]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/t/lp1091885_reingest_on_undelete.pg
LP#1091885: make sure bibs get reingested on undelete
[working/Evergreen.git] / Open-ILS / src / sql / Pg / t / lp1091885_reingest_on_undelete.pg
1 BEGIN;
2
3 SELECT plan(3);
4
5 ----------------------------------
6 -- Setup Test environment and data
7 ----------------------------------
8
9 -- create bib 71,000
10 INSERT into biblio.record_entry (id, marc, last_xact_id)
11   VALUES (71000, 
12   $$
13   <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"><leader>00934|jm a2200241 a 4500</leader><controlfield tag="001">03-0003745</controlfield><controlfield tag="005">19991118131708.0</controlfield><controlfield tag="008">971016n nyuuuu eng </controlfield><datafield tag="050" ind1=" " ind2=" "><subfield code="a">4539</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Bart&#xF3;k, B&#xE9;la,</subfield><subfield code="d">1881-1945.</subfield></datafield><datafield tag="240" ind1=" " ind2=" "><subfield code="t">Concertos,</subfield><subfield code="m">piano,</subfield><subfield code="n">no. 1,</subfield><subfield code="n">Sz. 83</subfield><subfield code="f">(1926) </subfield><subfield code="a">Concertos,</subfield><subfield code="m">piano,</subfield><subfield code="n">no. 1,</subfield><subfield code="n">Sz. 83,</subfield><subfield code="n">(1926)</subfield></datafield><datafield tag="245" ind1=" " ind2=" "><subfield code="a">Piano concerto no. 1 (1926) ; Rhapsody, op. 1 (1904)</subfield></datafield><datafield tag="260" ind1=" " ind2=" "><subfield code="a">New York, NY :</subfield><subfield code="b">Vox</subfield></datafield></record>
14   $$,
15   'PGTAP'
16   );
17
18 -----------------------------------------
19 -- Test biblio.indexing_ingest_or_delete
20 -----------------------------------------
21
22 -- initially record attributes should exist since the record is inserted
23 SELECT is((SELECT EXISTS(SELECT 1 FROM metabib.record_attr WHERE id = 71000)), TRUE, 'Entries exist.');
24
25 -- check to see if record attributes are removed when the record is deleted
26 UPDATE biblio.record_entry SET deleted = TRUE WHERE id = 71000;
27 SELECT is((SELECT EXISTS(SELECT 1 FROM metabib.record_attr WHERE id = 71000)), FALSE, 'Entries should not exist.');
28
29 -- check to see if record attributes are restored when the record is undeleted
30 UPDATE biblio.record_entry SET deleted = FALSE WHERE id = 71000;
31 SELECT is((SELECT EXISTS(SELECT 1 FROM metabib.record_attr WHERE id = 71000)), TRUE, 'Entries exist.');
32
33 SELECT * FROM finish();
34
35 ROLLBACK;
36