LP#1596595: Stamping upgrade scripts for hold targeter refactoring
authorKathy Lussier <klussier@masslnc.org>
Fri, 17 Feb 2017 06:12:08 +0000 (01:12 -0500)
committerKathy Lussier <klussier@masslnc.org>
Fri, 17 Feb 2017 06:12:08 +0000 (01:12 -0500)
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1019.schema.hold_targeter.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/1020.schema.batch_settings_by_org.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold_targeter.sql [deleted file]
Open-ILS/src/sql/Pg/upgrade/YYYY.schema.batch_settings_by_org.sql [deleted file]

index e7323d5..954324b 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');
 
     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 ('1018', :eg_version); -- csharp/Dyrcona/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1020', :eg_version); -- berick/csharp/kmlussier
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1019.schema.hold_targeter.sql b/Open-ILS/src/sql/Pg/upgrade/1019.schema.hold_targeter.sql
new file mode 100644 (file)
index 0000000..61f3462
--- /dev/null
@@ -0,0 +1,27 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1019', :eg_version);
+
+CREATE OR REPLACE FUNCTION
+    action.hold_request_regen_copy_maps(
+        hold_id INTEGER, copy_ids INTEGER[]) RETURNS VOID AS $$
+    DELETE FROM action.hold_copy_map WHERE hold = $1;
+    INSERT INTO action.hold_copy_map (hold, target_copy) SELECT $1, UNNEST($2);
+$$ LANGUAGE SQL;
+
+-- DATA
+
+INSERT INTO config.global_flag (name, label, value, enabled) VALUES (
+    'circ.holds.retarget_interval',
+    oils_i18n_gettext(
+        'circ.holds.retarget_interval',
+        'Holds Retarget Interval', 
+        'cgf',
+        'label'
+    ),
+    '24h',
+    TRUE
+);
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/1020.schema.batch_settings_by_org.sql b/Open-ILS/src/sql/Pg/upgrade/1020.schema.batch_settings_by_org.sql
new file mode 100644 (file)
index 0000000..cc566ae
--- /dev/null
@@ -0,0 +1,26 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1020', :eg_version);
+
+CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch_by_org(
+    setting_name TEXT, org_ids INTEGER[]) 
+    RETURNS SETOF actor.org_unit_setting AS 
+$FUNK$
+DECLARE
+    setting RECORD;
+    org_id INTEGER;
+BEGIN
+    /*  Returns one actor.org_unit_setting row per org unit ID provided.
+        When no setting exists for a given org unit, the setting row
+        will contain all empty values. */
+    FOREACH org_id IN ARRAY org_ids LOOP
+        SELECT INTO setting * FROM 
+            actor.org_unit_ancestor_setting(setting_name, org_id);
+        RETURN NEXT setting;
+    END LOOP;
+    RETURN;
+END;
+$FUNK$ LANGUAGE plpgsql STABLE;
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold_targeter.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold_targeter.sql
deleted file mode 100644 (file)
index ba584f0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-BEGIN;
-
-CREATE OR REPLACE FUNCTION
-    action.hold_request_regen_copy_maps(
-        hold_id INTEGER, copy_ids INTEGER[]) RETURNS VOID AS $$
-    DELETE FROM action.hold_copy_map WHERE hold = $1;
-    INSERT INTO action.hold_copy_map (hold, target_copy) SELECT $1, UNNEST($2);
-$$ LANGUAGE SQL;
-
--- DATA
-
-INSERT INTO config.global_flag (name, label, value, enabled) VALUES (
-    'circ.holds.retarget_interval',
-    oils_i18n_gettext(
-        'circ.holds.retarget_interval',
-        'Holds Retarget Interval', 
-        'cgf',
-        'label'
-    ),
-    '24h',
-    TRUE
-);
-
-COMMIT;
-
diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.batch_settings_by_org.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.batch_settings_by_org.sql
deleted file mode 100644 (file)
index 567183f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-BEGIN;
-
-CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_setting_batch_by_org(
-    setting_name TEXT, org_ids INTEGER[]) 
-    RETURNS SETOF actor.org_unit_setting AS 
-$FUNK$
-DECLARE
-    setting RECORD;
-    org_id INTEGER;
-BEGIN
-    /*  Returns one actor.org_unit_setting row per org unit ID provided.
-        When no setting exists for a given org unit, the setting row
-        will contain all empty values. */
-    FOREACH org_id IN ARRAY org_ids LOOP
-        SELECT INTO setting * FROM 
-            actor.org_unit_ancestor_setting(setting_name, org_id);
-        RETURN NEXT setting;
-    END LOOP;
-    RETURN;
-END;
-$FUNK$ LANGUAGE plpgsql STABLE;
-
-COMMIT;
-