Stamping upgrade script for "Fix part holds in reporter.hold_request_record"
authorMike Rylander <mrylander@gmail.com>
Sat, 16 Jul 2011 00:08:35 +0000 (20:08 -0400)
committerMike Rylander <mrylander@gmail.com>
Sat, 16 Jul 2011 00:08:35 +0000 (20:08 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0578.schema.part_holds_bib_report.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.part_holds_bib_report.sql [deleted file]

index 7757c97..d2d2836 100644 (file)
@@ -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 (file)
index 0000000..9d4469d
--- /dev/null
@@ -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 (file)
index 763bb01..0000000
+++ /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;
-