[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3edbdfcc1e834c74801ae7021592dbfd418ffafe

Evergreen Git git at git.evergreen-ils.org
Wed Sep 20 17:33:06 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  3edbdfcc1e834c74801ae7021592dbfd418ffafe (commit)
       via  ab2edc459086ae5a4abd1d8bdf08d6f18497a388 (commit)
       via  8c04e4a92dad17b1bdf2ee1dd9df33a0d583fe9c (commit)
      from  b87a437825a531a3e6977d1e0b17e48d8f41f74a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3edbdfcc1e834c74801ae7021592dbfd418ffafe
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 20 17:48:33 2017 -0400

    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 <gmc at equinoxinitiative.org>

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 0da1859..d10e316 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)

commit ab2edc459086ae5a4abd1d8bdf08d6f18497a388
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Wed Sep 20 17:46:19 2017 -0400

    LP#1718300: stamp schema update
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 06c7836..ff85e0e 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,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 ('1075', :eg_version); -- gmcharlt/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1076', :eg_version); -- miker/gmcharlt
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql b/Open-ILS/src/sql/Pg/upgrade/1076.function.copy_vis_attr_cache_fixup.sql
similarity index 98%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql
rename to Open-ILS/src/sql/Pg/upgrade/1076.function.copy_vis_attr_cache_fixup.sql
index c5f5042..151b705 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1076.function.copy_vis_attr_cache_fixup.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); -- miker
+SELECT evergreen.upgrade_deps_block_check('1076', :eg_version); -- miker/gmcharlt
 
 CREATE OR REPLACE FUNCTION asset.cache_copy_visibility () RETURNS TRIGGER as $func$
 DECLARE

commit 8c04e4a92dad17b1bdf2ee1dd9df33a0d583fe9c
Author: Mike Rylander <mrylander at gmail.com>
Date:   Wed Sep 20 14:42:01 2017 -0400

    LP#1718300: Fix serial.unit visibility at creation time
    
    The new copy visibility trigger was not taking into account a particular
    dataflow that is common to the serial checkin process.  This branch
    addressed that case where the call number of a copy changes, requiring
    an update of one row on the cache table.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
index fee4929..3349a45 100644
--- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
+++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
@@ -644,6 +644,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;
 
@@ -652,9 +660,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)
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql
new file mode 100644
index 0000000..c5f5042
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_vis_attr_cache_fixup.sql
@@ -0,0 +1,149 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); -- miker
+
+CREATE OR REPLACE FUNCTION asset.cache_copy_visibility () RETURNS TRIGGER as $func$
+DECLARE
+    ocn     asset.call_number%ROWTYPE;
+    ncn     asset.call_number%ROWTYPE;
+    cid     BIGINT;
+BEGIN
+
+    IF TG_TABLE_NAME = 'peer_bib_copy_map' THEN -- Only needs ON INSERT OR DELETE, so handle separately
+        IF TG_OP = 'INSERT' THEN
+            INSERT INTO asset.copy_vis_attr_cache (record, target_copy, vis_attr_vector) VALUES (
+                NEW.peer_record,
+                NEW.target_copy,
+                asset.calculate_copy_visibility_attribute_set(NEW.target_copy)
+            );
+
+            RETURN NEW;
+        ELSIF TG_OP = 'DELETE' THEN
+            DELETE FROM asset.copy_vis_attr_cache
+              WHERE record = NEW.peer_record AND target_copy = NEW.target_copy;
+
+            RETURN OLD;
+        END IF;
+    END IF;
+
+    IF TG_OP = 'INSERT' THEN -- Handles ON INSERT. ON UPDATE is below.
+        IF TG_TABLE_NAME IN ('copy', 'unit') THEN
+            SELECT * INTO ncn FROM asset.call_number cn WHERE id = NEW.call_number;
+            INSERT INTO asset.copy_vis_attr_cache (record, target_copy, vis_attr_vector) VALUES (
+                ncn.record,
+                NEW.id,
+                asset.calculate_copy_visibility_attribute_set(NEW.id)
+            );
+        ELSIF TG_TABLE_NAME = 'record_entry' THEN
+            NEW.vis_attr_vector := biblio.calculate_bib_visibility_attribute_set(NEW.id);
+        END IF;
+
+        RETURN NEW;
+    END IF;
+
+    -- handle items first, since with circulation activity
+    -- their statuses change frequently
+    IF TG_TABLE_NAME IN ('copy', 'unit') THEN -- This handles ON UPDATE OR DELETE. ON INSERT above
+
+        IF TG_OP = 'DELETE' THEN -- Shouldn't get here, normally
+            DELETE FROM asset.copy_vis_attr_cache WHERE target_copy = OLD.id;
+            RETURN OLD;
+        END IF;
+
+        SELECT * INTO ncn FROM asset.call_number cn WHERE id = NEW.call_number;
+
+        IF OLD.deleted <> NEW.deleted THEN
+            IF NEW.deleted THEN
+                DELETE FROM asset.copy_vis_attr_cache WHERE target_copy = OLD.id;
+            ELSE
+                INSERT INTO asset.copy_vis_attr_cache (record, target_copy, vis_attr_vector) VALUES (
+                    ncn.record,
+                    NEW.id,
+                    asset.calculate_copy_visibility_attribute_set(NEW.id)
+                );
+            END IF;
+
+            RETURN NEW;
+        ELSIF OLD.call_number  <> NEW.call_number THEN
+            SELECT * INTO ocn FROM asset.call_number cn WHERE id = OLD.call_number;
+
+            IF ncn.record <> ocn.record THEN
+                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;
+
+        IF OLD.location     <> NEW.location OR
+           OLD.status       <> NEW.status OR
+           OLD.opac_visible <> NEW.opac_visible OR
+           OLD.circ_lib     <> NEW.circ_lib
+        THEN
+            -- Any of these could change visibility, but
+            -- we'll save some queries and not try to calculate
+            -- 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)
+              WHERE target_copy = OLD.id;
+
+        END IF;
+
+    ELSIF TG_TABLE_NAME = 'call_number' THEN -- Only ON UPDATE. Copy handler will deal with ON INSERT OR DELETE.
+
+        IF OLD.record <> NEW.record THEN
+            IF NEW.label = '##URI##' THEN
+                UPDATE  biblio.record_entry
+                  SET   vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(OLD.record)
+                  WHERE id = OLD.record;
+
+                UPDATE  biblio.record_entry
+                  SET   vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(NEW.record)
+                  WHERE id = NEW.record;
+            END IF;
+
+            UPDATE  asset.copy_vis_attr_cache
+              SET   record = NEW.record,
+                    vis_attr_vector = asset.calculate_copy_visibility_attribute_set(target_copy)
+              WHERE target_copy IN (SELECT id FROM asset.copy WHERE call_number = NEW.id)
+                    AND record = OLD.record;
+
+        ELSIF OLD.owning_lib <> NEW.owning_lib THEN
+            UPDATE  asset.copy_vis_attr_cache
+              SET   vis_attr_vector = asset.calculate_copy_visibility_attribute_set(target_copy)
+              WHERE target_copy IN (SELECT id FROM asset.copy WHERE call_number = NEW.id)
+                    AND record = NEW.record;
+
+            IF NEW.label = '##URI##' THEN
+                UPDATE  biblio.record_entry
+                  SET   vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(OLD.record)
+                  WHERE id = OLD.record;
+            END IF;
+        END IF;
+
+    ELSIF TG_TABLE_NAME = 'record_entry' THEN -- Only handles ON UPDATE OR DELETE
+
+        IF TG_OP = 'DELETE' THEN -- Shouldn't get here, normally
+            DELETE FROM asset.copy_vis_attr_cache WHERE record = OLD.id;
+            RETURN OLD;
+        ELSIF OLD.source <> NEW.source THEN
+            NEW.vis_attr_vector := biblio.calculate_bib_visibility_attribute_set(NEW.id);
+        END IF;
+
+    END IF;
+
+    RETURN NEW;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
+

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/300.schema.staged_search.sql   |   13 ++-
 .../1076.function.copy_vis_attr_cache_fixup.sql    |  149 ++++++++++++++++++++
 .../2.12.5-3.0-beta1-upgrade-db.sql                |   16 ++-
 4 files changed, 175 insertions(+), 5 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/1076.function.copy_vis_attr_cache_fixup.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list