From: Mike Rylander Date: Mon, 19 Mar 2012 15:57:19 +0000 (-0400) Subject: Stamping BluRay videorecording format upgrade X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c464139505dae781cc491b78d1bd277bee99f258;p=contrib%2FConifer.git Stamping BluRay videorecording format upgrade Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index c2fee1cf55..67308e683f 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0684', :eg_version); -- berick/miker +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0685', :eg_version); -- tsbere/miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0685.data.bluray_vr_format.sql b/Open-ILS/src/sql/Pg/upgrade/0685.data.bluray_vr_format.sql new file mode 100644 index 0000000000..95dda74cd5 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0685.data.bluray_vr_format.sql @@ -0,0 +1,47 @@ +-- Evergreen DB patch 0685.data.bluray_vr_format.sql +-- +-- FIXME: insert description of change, if needed +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0685', :eg_version); + +-- FIXME: add/check SQL statements to perform the upgrade +DO $FUNC$ +DECLARE + same_marc BOOL; +BEGIN + -- Check if it is already there + PERFORM * FROM config.marc21_physical_characteristic_value_map v + JOIN config.marc21_physical_characteristic_subfield_map s ON v.ptype_subfield = s.id + WHERE s.ptype_key = 'v' AND s.subfield = 'e' AND s.start_pos = '4' AND s.length = '1' + AND v.value = 's'; + + -- If it is, bail. + IF FOUND THEN + RETURN; + END IF; + + -- Otherwise, insert it + INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) + SELECT 's',id,'Blu-ray' + FROM config.marc21_physical_characteristic_subfield_map + WHERE ptype_key = 'v' AND subfield = 'e' AND start_pos = '4' AND length = '1'; + + -- And reingest the blue-ray items so that things see the new value + SELECT INTO same_marc enabled FROM config.internal_flag WHERE name = 'ingest.reingest.force_on_same_marc'; + UPDATE config.internal_flag SET enabled = true WHERE name = 'ingest.reingest.force_on_same_marc'; + UPDATE biblio.record_entry SET marc=marc WHERE id IN (SELECT record + FROM + metabib.full_rec a JOIN metabib.full_rec b USING (record) + WHERE + a.tag = 'LDR' AND a.value LIKE '______g%' + AND b.tag = '007' AND b.value LIKE 'v___s%'); + UPDATE config.internal_flag SET enabled = same_marc WHERE name = 'ingest.reingest.force_on_same_marc'; +END; +$FUNC$; + + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql deleted file mode 100644 index cfd8c978b9..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.bluray_vr_format.sql +++ /dev/null @@ -1,33 +0,0 @@ -DO $FUNC$ -DECLARE - same_marc BOOL; -BEGIN - -- Check if it is already there - PERFORM * FROM config.marc21_physical_characteristic_value_map v - JOIN config.marc21_physical_characteristic_subfield_map s ON v.ptype_subfield = s.id - WHERE s.ptype_key = 'v' AND s.subfield = 'e' AND s.start_pos = '4' AND s.length = '1' - AND v.value = 's'; - - -- If it is, bail. - IF FOUND THEN - RETURN; - END IF; - - -- Otherwise, insert it - INSERT INTO config.marc21_physical_characteristic_value_map (value,ptype_subfield,label) - SELECT 's',id,'Blu-ray' - FROM config.marc21_physical_characteristic_subfield_map - WHERE ptype_key = 'v' AND subfield = 'e' AND start_pos = '4' AND length = '1'; - - -- And reingest the blue-ray items so that things see the new value - SELECT INTO same_marc enabled FROM config.internal_flag WHERE name = 'ingest.reingest.force_on_same_marc'; - UPDATE config.internal_flag SET enabled = true WHERE name = 'ingest.reingest.force_on_same_marc'; - UPDATE biblio.record_entry SET marc=marc WHERE id IN (SELECT record - FROM - metabib.full_rec a JOIN metabib.full_rec b USING (record) - WHERE - a.tag = 'LDR' AND a.value LIKE '______g%' - AND b.tag = '007' AND b.value LIKE 'v___s%'); - UPDATE config.internal_flag SET enabled = same_marc WHERE name = 'ingest.reingest.force_on_same_marc'; -END; -$FUNC$;