moving the the upgrade SQL scripts to an unversioned "upgrade" directory instead...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 15 Sep 2009 20:23:42 +0000 (20:23 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 15 Sep 2009 20:23:42 +0000 (20:23 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14028 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/090.schema.action.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0001.data.config.org_unit_setting_type.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade_1.6_trunk/0001.data.config.org_unit_setting_type.sql [deleted file]

index 538f046..d3fd940 100644 (file)
@@ -51,6 +51,8 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
+INSERT INTO config.upgrade_log (version) VALUES ('0003');
+
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
        quality         INT     CHECK ( quality BETWEEN 0 AND 100 ),
index 2de8ce3..8362f6c 100644 (file)
@@ -385,6 +385,28 @@ CREATE TABLE action.unfulfilled_hold_list (
        circ_lib        INT                             NOT NULL,
        fail_time       TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW()
 );
+CREATE INDEX uhr_hold_idx ON action.unfulfilled_hold_list (hold);
+
+CREATE OR REPLACE VIEW action.unfulfilled_hold_loops AS
+    SELECT  u.hold,
+            c.circ_lib,
+            count(*)
+      FROM  action.unfulfilled_hold_list u
+            JOIN asset.copy c ON (c.id = u.current_copy)
+      GROUP BY 1,2;
+
+CREATE OR REPLACE VIEW action.unfulfilled_hold_min_loop AS
+    SELECT  hold,
+            min(count)
+      FROM  action.unfulfilled_hold_loops
+      GROUP BY 1;
+
+CREATE OR REPLACE VIEW action.unfulfilled_hold_innermost_loop AS
+    SELECT  DISTINCT l.*
+      FROM  action.unfulfilled_hold_loops l
+            JOIN action.unfulfilled_hold_min_loop m USING (hold)
+      WHERE l.count = m.min;
+
 
 COMMIT;
 
index af3fcdd..383831b 100644 (file)
@@ -2161,3 +2161,26 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
 
 SELECT SETVAL('action_trigger.event_definition_id_seq'::TEXT, 100);
 
+-- Org Unit Settings for configuring org unit weights and org unit max-loops for hold targeting
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.org_unit_target_weight',
+    'Holds: Org Unit Target Weight',
+    'Org Units can be organized into hold target groups based on a weight.  Potential copies from org units with the same weight are chosen at random.',
+    'integer'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.target_holds_by_org_unit_weight',
+    'Holds: Use weight-based hold targeting',
+    'Use library weight based hold targeting',
+    'bool'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.max_org_unit_target_loops',
+    'Holds: Maximum library target attempts',
+    'When this value is set and greater than 0, the system will only attempt to find a copy at each possible branch the configured number of times',
+    'integer'
+);
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/0001.data.config.org_unit_setting_type.sql b/Open-ILS/src/sql/Pg/upgrade/0001.data.config.org_unit_setting_type.sql
new file mode 100644 (file)
index 0000000..395d525
--- /dev/null
@@ -0,0 +1,29 @@
+BEGIN;
+
+-- Org Unit Settings for configuring org unit weights and org unit max-loops for hold targeting
+
+INSERT INTO config.upgrade_log (version) VALUES ('0001.data.config.org_unit_setting_type.sql');
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.org_unit_target_weight',
+    'Holds: Org Unit Target Weight',
+    'Org Units can be organized into hold target groups based on a weight.  Potential copies from org units with the same weight are chosen at random.',
+    'integer'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.target_holds_by_org_unit_weight',
+    'Holds: Use weight-based hold targeting',
+    'Use library weight based hold targeting',
+    'bool'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+    'circ.holds.max_org_unit_target_loops',
+    'Holds: Maximum library target attempts',
+    'When this value is set and greater than 0, the system will only attempt to find a copy at each possible branch the configured number of times',
+    'integer'
+);
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade_1.6_trunk/0001.data.config.org_unit_setting_type.sql b/Open-ILS/src/sql/Pg/upgrade_1.6_trunk/0001.data.config.org_unit_setting_type.sql
deleted file mode 100644 (file)
index 395d525..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-BEGIN;
-
--- Org Unit Settings for configuring org unit weights and org unit max-loops for hold targeting
-
-INSERT INTO config.upgrade_log (version) VALUES ('0001.data.config.org_unit_setting_type.sql');
-
-INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
-    'circ.holds.org_unit_target_weight',
-    'Holds: Org Unit Target Weight',
-    'Org Units can be organized into hold target groups based on a weight.  Potential copies from org units with the same weight are chosen at random.',
-    'integer'
-);
-
-INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
-    'circ.holds.target_holds_by_org_unit_weight',
-    'Holds: Use weight-based hold targeting',
-    'Use library weight based hold targeting',
-    'bool'
-);
-
-INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
-    'circ.holds.max_org_unit_target_loops',
-    'Holds: Maximum library target attempts',
-    'When this value is set and greater than 0, the system will only attempt to find a copy at each possible branch the configured number of times',
-    'integer'
-);
-
-COMMIT;
-