From: Mike Rylander Date: Sat, 16 Jul 2011 00:08:35 +0000 (-0400) Subject: Stamping upgrade script for "Fix part holds in reporter.hold_request_record" X-Git-Tag: sprint4-merge-nov22~5384 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b8914c02d71a66f151f45d7b1ba07fc6988163a6;p=working%2FEvergreen.git Stamping upgrade script for "Fix part holds in reporter.hold_request_record" 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 7757c97bea..d2d283661d 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 ('0577', :eg_version); -- berick +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0578', :eg_version); -- tsbere via miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0578.schema.part_holds_bib_report.sql b/Open-ILS/src/sql/Pg/upgrade/0578.schema.part_holds_bib_report.sql new file mode 100644 index 0000000000..9d4469d8c4 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0578.schema.part_holds_bib_report.sql @@ -0,0 +1,32 @@ +-- Evergreen DB patch 0578.schema.part_holds_bib_report.sql +-- +-- Fix part holds in reporter.hold_request_record +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0578', :eg_version); + +CREATE OR REPLACE VIEW reporter.hold_request_record AS +SELECT id, + target, + hold_type, + CASE + WHEN hold_type = 'T' + THEN target + WHEN hold_type = 'I' + THEN (SELECT ssub.record_entry FROM serial.subscription ssub JOIN serial.issuance si ON (si.subscription = ssub.id) WHERE si.id = ahr.target) + WHEN hold_type = 'V' + THEN (SELECT cn.record FROM asset.call_number cn WHERE cn.id = ahr.target) + WHEN hold_type IN ('C','R','F') + THEN (SELECT cn.record FROM asset.call_number cn JOIN asset.copy cp ON (cn.id = cp.call_number) WHERE cp.id = ahr.target) + WHEN hold_type = 'M' + THEN (SELECT mr.master_record FROM metabib.metarecord mr WHERE mr.id = ahr.target) + WHEN hold_type = 'P' + THEN (SELECT bmp.record FROM biblio.monograph_part bmp WHERE bmp.id = ahr.target) + END AS bib_record + FROM action.hold_request ahr; + +COMMIT; + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.part_holds_bib_report.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.part_holds_bib_report.sql deleted file mode 100644 index 763bb0142f..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.part_holds_bib_report.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE OR REPLACE VIEW reporter.hold_request_record AS -SELECT id, - target, - hold_type, - CASE - WHEN hold_type = 'T' - THEN target - WHEN hold_type = 'I' - THEN (SELECT ssub.record_entry FROM serial.subscription ssub JOIN serial.issuance si ON (si.subscription = ssub.id) WHERE si.id = ahr.target) - WHEN hold_type = 'V' - THEN (SELECT cn.record FROM asset.call_number cn WHERE cn.id = ahr.target) - WHEN hold_type IN ('C','R','F') - THEN (SELECT cn.record FROM asset.call_number cn JOIN asset.copy cp ON (cn.id = cp.call_number) WHERE cp.id = ahr.target) - WHEN hold_type = 'M' - THEN (SELECT mr.master_record FROM metabib.metarecord mr WHERE mr.id = ahr.target) - WHEN hold_type = 'P' - THEN (SELECT bmp.record FROM biblio.monograph_part bmp WHERE bmp.id = ahr.target) - END AS bib_record - FROM action.hold_request ahr; -