LP#1501471: Stamping SQL update
authorBill Erickson <berickxx@gmail.com>
Thu, 5 Nov 2015 14:27:51 +0000 (09:27 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 5 Nov 2015 14:27:51 +0000 (09:27 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0946.schema.batch_settings_retrieve_function.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.batch_settings_retrieve_function.sql [deleted file]

index c9a21dd..b0739fb 100644 (file)
@@ -91,7 +91,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 ('0945', :eg_version); -- berick/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0946', :eg_version); -- gmcharlt/berick
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0946.schema.batch_settings_retrieve_function.sql b/Open-ILS/src/sql/Pg/upgrade/0946.schema.batch_settings_retrieve_function.sql
new file mode 100644 (file)
index 0000000..2209ea6
--- /dev/null
@@ -0,0 +1,33 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0946', :eg_version);
+
+CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch( org_id INT, VARIADIC setting_names TEXT[] ) RETURNS SETOF actor.org_unit_setting AS $$
+DECLARE
+    setting RECORD;
+    setting_name TEXT;
+    cur_org INT;
+BEGIN
+    FOREACH setting_name IN ARRAY setting_names
+    LOOP
+        cur_org := org_id;
+        LOOP
+            SELECT INTO setting * FROM actor.org_unit_setting WHERE org_unit = cur_org AND name = setting_name;
+            IF FOUND THEN
+                RETURN NEXT setting;
+                EXIT;
+            END IF;
+            SELECT INTO cur_org parent_ou FROM actor.org_unit WHERE id = cur_org;
+            EXIT WHEN cur_org IS NULL;
+        END LOOP;
+    END LOOP;
+    RETURN;
+END;
+$$ LANGUAGE plpgsql STABLE;
+
+COMMENT ON FUNCTION actor.org_unit_ancestor_setting_batch( INT, VARIADIC TEXT[] ) IS $$
+For each setting name passed, search "up" the org_unit tree until
+we find the first occurrence of an org_unit_setting with the given name.
+$$;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.batch_settings_retrieve_function.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.batch_settings_retrieve_function.sql
deleted file mode 100644 (file)
index 63e3234..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-BEGIN;
-
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch( org_id INT, VARIADIC setting_names TEXT[] ) RETURNS SETOF actor.org_unit_setting AS $$
-DECLARE
-    setting RECORD;
-    setting_name TEXT;
-    cur_org INT;
-BEGIN
-    FOREACH setting_name IN ARRAY setting_names
-    LOOP
-        cur_org := org_id;
-        LOOP
-            SELECT INTO setting * FROM actor.org_unit_setting WHERE org_unit = cur_org AND name = setting_name;
-            IF FOUND THEN
-                RETURN NEXT setting;
-                EXIT;
-            END IF;
-            SELECT INTO cur_org parent_ou FROM actor.org_unit WHERE id = cur_org;
-            EXIT WHEN cur_org IS NULL;
-        END LOOP;
-    END LOOP;
-    RETURN;
-END;
-$$ LANGUAGE plpgsql STABLE;
-
-COMMENT ON FUNCTION actor.org_unit_ancestor_setting_batch( INT, VARIADIC TEXT[] ) IS $$
-For each setting name passed, search "up" the org_unit tree until
-we find the first occurrence of an org_unit_setting with the given name.
-$$;
-
-COMMIT;