From 3edbdfcc1e834c74801ae7021592dbfd418ffafe Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 20 Sep 2017 17:48:33 -0400 Subject: [PATCH] LP#1718300: fold update into 2.12.5-3.0-beta schema update This saves a step for building the beta2 release, as 2.12.5-3.0-beta1-upgrade-db.sql will be moved to 2.12.5-3.0-beta2-upgrade-db.sql. Signed-off-by: Galen Charlton --- .../Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql index 0da18594c9..d10e316e77 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql @@ -1867,6 +1867,9 @@ BEGIN END; $f$ LANGUAGE PLPGSQL; + +SELECT evergreen.upgrade_deps_block_check('1076', :eg_version); -- miker/gmcharlt + CREATE OR REPLACE FUNCTION asset.cache_copy_visibility () RETURNS TRIGGER as $func$ DECLARE ocn asset.call_number%ROWTYPE; @@ -1936,6 +1939,14 @@ BEGIN UPDATE biblio.record_entry SET vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(ncn.record) WHERE id = ocn.record; + + -- We have to use a record-specific WHERE clause + -- to avoid modifying the entries for peer-bib copies. + UPDATE asset.copy_vis_attr_cache + SET target_copy = NEW.id, + record = ncn.record + WHERE target_copy = OLD.id + AND record = ocn.record; END IF; END IF; @@ -1944,9 +1955,10 @@ BEGIN OLD.opac_visible <> NEW.opac_visible OR OLD.circ_lib <> NEW.circ_lib THEN - -- any of these could change visibility, but + -- Any of these could change visibility, but -- we'll save some queries and not try to calculate - -- the change directly + -- the change directly. We want to update peer-bib + -- entries in this case, unlike above. UPDATE asset.copy_vis_attr_cache SET target_copy = NEW.id, vis_attr_vector = asset.calculate_copy_visibility_attribute_set(NEW.id) -- 2.11.0