[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. 4f01a25a2018d04e1108a061afd4878b4396cb07

Evergreen Git git at git.evergreen-ils.org
Fri May 24 16:36:17 EDT 2019


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, rel_3_1 has been updated
       via  4f01a25a2018d04e1108a061afd4878b4396cb07 (commit)
      from  bc70a2473bcd53edb8f15d402e9b96b8595ffb4b (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 4f01a25a2018d04e1108a061afd4878b4396cb07
Author: Bill Ott <bott at grpl.org>
Date:   Fri May 18 09:52:46 2018 -0400

    LP#1772028 Add some FK violation functions just in case they are missing
    
    Depending on your data, upgrade 1063 may not have created the functions
    being re-applied in this upgrade script.  Let's make sure they are
    there.
    
    Signed-off-by: Bill Ott <bott at grpl.org>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/3.0.1-3.0.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/3.0.1-3.0.2-upgrade-db.sql
index 7c30ed70fc..f8addc8032 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/3.0.1-3.0.2-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/3.0.1-3.0.2-upgrade-db.sql
@@ -412,6 +412,54 @@ $func$ LANGUAGE PLPGSQL;
 
 SELECT evergreen.upgrade_deps_block_check('1081', :eg_version); -- jboyer/gmcharlt
 
+CREATE OR REPLACE FUNCTION evergreen.container_copy_bucket_item_target_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+        PERFORM 1 FROM asset.copy WHERE id = NEW.target_copy;
+        IF NOT FOUND THEN
+                RAISE foreign_key_violation USING MESSAGE = FORMAT(
+                        $$Referenced asset.copy id not found, target_copy:%s$$, NEW.target_copy
+                );
+        END IF;
+        RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
+CREATE OR REPLACE FUNCTION evergreen.asset_copy_note_owning_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+        PERFORM 1 FROM asset.copy WHERE id = NEW.owning_copy;
+        IF NOT FOUND THEN
+                RAISE foreign_key_violation USING MESSAGE = FORMAT(
+                        $$Referenced asset.copy id not found, owning_copy:%s$$, NEW.owning_copy
+                );
+        END IF;
+        RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
+CREATE OR REPLACE FUNCTION evergreen.asset_copy_tag_copy_map_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+        PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
+        IF NOT FOUND THEN
+                RAISE foreign_key_violation USING MESSAGE = FORMAT(
+                        $$Referenced asset.copy id not found, copy:%s$$, NEW.copy
+                );
+        END IF;
+        RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
+CREATE OR REPLACE FUNCTION evergreen.asset_copy_alert_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+        PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
+        IF NOT FOUND THEN
+                RAISE foreign_key_violation USING MESSAGE = FORMAT(
+                        $$Referenced asset.copy id not found, copy:%s$$, NEW.copy
+                );
+        END IF;
+        RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
 DROP TRIGGER IF EXISTS inherit_copy_bucket_item_target_copy_fkey ON container.copy_bucket_item;
 DROP TRIGGER IF EXISTS inherit_import_item_imported_as_fkey ON vandelay.import_item;
 DROP TRIGGER IF EXISTS inherit_asset_copy_note_copy_fkey ON asset.copy_note;

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

Summary of changes:
 .../Pg/version-upgrade/3.0.1-3.0.2-upgrade-db.sql  | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list