From 7f25c35f3242baef8306577ebe13785f2b1b472d Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Sat, 16 Jul 2011 10:08:03 -0400 Subject: [PATCH] Stamping upgrade script for "Prevent OU loops at DB level" Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- ..._parent_protect.sql => 0580.schema.aou_parent_protec.sql} | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) rename Open-ILS/src/sql/Pg/upgrade/{XXXX.aou_parent_protect.sql => 0580.schema.aou_parent_protec.sql} (87%) diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index df635b83a8..5adb85517f 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -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 ('0579', :eg_version); -- tsbere via miker +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0580', :eg_version); -- tsbere via miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.aou_parent_protect.sql b/Open-ILS/src/sql/Pg/upgrade/0580.schema.aou_parent_protec.sql similarity index 87% rename from Open-ILS/src/sql/Pg/upgrade/XXXX.aou_parent_protect.sql rename to Open-ILS/src/sql/Pg/upgrade/0580.schema.aou_parent_protec.sql index 589aa973f6..1c86c0aa02 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.aou_parent_protect.sql +++ b/Open-ILS/src/sql/Pg/upgrade/0580.schema.aou_parent_protec.sql @@ -1,3 +1,12 @@ +-- Evergreen DB patch 0580.schema.aou_parent_protec.sql +-- +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0580', :eg_version); + CREATE OR REPLACE FUNCTION actor.org_unit_parent_protect () RETURNS TRIGGER AS $$ DECLARE current_aou actor.org_unit%ROWTYPE; @@ -31,3 +40,6 @@ $$ LANGUAGE PLPGSQL; CREATE TRIGGER actor_org_unit_parent_protect_trigger BEFORE INSERT OR UPDATE ON actor.org_unit FOR EACH ROW EXECUTE PROCEDURE actor.org_unit_parent_protect (); + + +COMMIT; -- 2.11.0