JBAS-944 Add extend_reporter changes for 2.7 upgrade
authorBill Erickson <berickxx@gmail.com>
Tue, 19 Jan 2016 15:55:58 +0000 (10:55 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
These changes were not included in the version upgrade scripts, since
they were optional.  We need them locally.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/sql/schema/deploy/2.5-to-2.7-upgrade.sql

index f6a8e5f..007091c 100644 (file)
@@ -8926,6 +8926,14 @@ UPDATE authority.control_set_authority_field SET sf_list = REGEXP_REPLACE( sf_li
 
 UPDATE authority.control_set_authority_field SET sf_list = REGEXP_REPLACE( sf_list, 'e', '', 'i') WHERE tag = '110' AND control_set = 1 AND  sf_list ILIKE '%e%';
 
+-- see note at the bottom of 2.5.3-2.6.0-upgrade-db.sql
+CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
+    SELECT cp.id,
+    COALESCE((SELECT circ_count FROM extend_reporter.legacy_circ_count WHERE id = cp.id), 0)
+    + (SELECT COUNT(*) FROM action.circulation WHERE target_copy = cp.id)
+    + (SELECT COUNT(*) FROM action.aged_circulation WHERE target_copy = cp.id) AS circ_count
+    FROM asset.copy cp;
+
 COMMIT;