[open-ils-commits] [GIT] Evergreen ILS branch master updated. b8ddd5fdd2cd05616f337a5b7ea9e57f015fe4e8

Evergreen Git git at git.evergreen-ils.org
Tue Aug 23 14:37:20 EDT 2011


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, master has been updated
       via  b8ddd5fdd2cd05616f337a5b7ea9e57f015fe4e8 (commit)
       via  1104e5158bbcff1c81a5e57d2170786bbd7ba0ae (commit)
       via  9add64f156b8f96c83092785d1bc5a40b986eb9e (commit)
       via  310516f77aab635baa5d986d12166005d356e56f (commit)
      from  22813f800eaaea6037507f36eaff8bd55127a2eb (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 b8ddd5fdd2cd05616f337a5b7ea9e57f015fe4e8
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Aug 23 14:32:17 2011 -0400

    master-stamped upgrade script for LP#816131
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index f4528b6..623af3d 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 ('0606', :eg_version); -- phasefx/berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0607', :eg_version); -- phasefx/berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql b/Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql
similarity index 74%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
rename to Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql
index 9e14639..53905f4 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql
@@ -1,3 +1,12 @@
+-- Evergreen DB patch 0607.schema.oua_force_order.sql
+--
+--
+BEGIN;
+
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0607', :eg_version);
+
 CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.org_unit AS $$
     WITH RECURSIVE org_unit_ancestors_distance(id, distance) AS (
             SELECT $1, 0
@@ -9,3 +18,6 @@ CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.o
     SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance DESC;
 $$ LANGUAGE SQL ROWS 1;
 
+
+
+COMMIT;

commit 1104e5158bbcff1c81a5e57d2170786bbd7ba0ae
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Mon Aug 22 14:44:17 2011 -0400

    Reverse direction of org_unit_ancestors
    
    Apparently callers expect it to start at the top of the org tree.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql
index ff8751e..1f78468 100644
--- a/Open-ILS/src/sql/Pg/020.schema.functions.sql
+++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql
@@ -242,7 +242,7 @@ CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.o
             FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad ON (ou.id = ouad.id)
             WHERE ou.parent_ou IS NOT NULL
     )
-    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance;
+    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance DESC;
 $$ LANGUAGE SQL ROWS 1;
 
 CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_at_depth ( INT,INT ) RETURNS actor.org_unit AS $$
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
index 84d864b..9e14639 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
@@ -6,6 +6,6 @@ CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.o
             FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad ON (ou.id = ouad.id)
             WHERE ou.parent_ou IS NOT NULL
     )
-    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance;
+    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance DESC;
 $$ LANGUAGE SQL ROWS 1;
 

commit 9add64f156b8f96c83092785d1bc5a40b986eb9e
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Aug 11 09:36:36 2011 -0400

    Unwrapped upgrade script for oua_force_order
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
new file mode 100644
index 0000000..84d864b
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql
@@ -0,0 +1,11 @@
+CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.org_unit AS $$
+    WITH RECURSIVE org_unit_ancestors_distance(id, distance) AS (
+            SELECT $1, 0
+        UNION
+            SELECT ou.parent_ou, ouad.distance+1
+            FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad ON (ou.id = ouad.id)
+            WHERE ou.parent_ou IS NOT NULL
+    )
+    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance;
+$$ LANGUAGE SQL ROWS 1;
+

commit 310516f77aab635baa5d986d12166005d356e56f
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Aug 11 09:35:18 2011 -0400

    New version of actor.org_unit_ancestors
    
    Preserves order through joins
    
    Basically actor.org_unit_ancestors_distance with a join to get the
    entire org units, rather than just IDs and a distance.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql
index 5653ded..ff8751e 100644
--- a/Open-ILS/src/sql/Pg/020.schema.functions.sql
+++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql
@@ -235,17 +235,14 @@ CREATE OR REPLACE FUNCTION actor.org_unit_descendants_distance( INT ) RETURNS TA
 $$ LANGUAGE SQL STABLE ROWS 1;
 
 CREATE OR REPLACE FUNCTION actor.org_unit_ancestors( INT ) RETURNS SETOF actor.org_unit AS $$
-    WITH RECURSIVE anscestor_depth AS (
-        SELECT  ou.id,
-                ou.parent_ou
-          FROM  actor.org_unit ou
-          WHERE ou.id = $1
-            UNION ALL
-        SELECT  ou.id,
-                ou.parent_ou
-          FROM  actor.org_unit ou
-                JOIN anscestor_depth ot ON (ot.parent_ou = ou.id)
-    ) SELECT ou.* FROM actor.org_unit ou JOIN anscestor_depth USING (id);
+    WITH RECURSIVE org_unit_ancestors_distance(id, distance) AS (
+            SELECT $1, 0
+        UNION
+            SELECT ou.parent_ou, ouad.distance+1
+            FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad ON (ou.id = ouad.id)
+            WHERE ou.parent_ou IS NOT NULL
+    )
+    SELECT ou.* FROM actor.org_unit ou JOIN org_unit_ancestors_distance ouad USING (id) ORDER BY ouad.distance;
 $$ LANGUAGE SQL ROWS 1;
 
 CREATE OR REPLACE FUNCTION actor.org_unit_ancestor_at_depth ( INT,INT ) RETURNS actor.org_unit AS $$

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/020.schema.functions.sql       |   19 +++++++---------
 .../sql/Pg/upgrade/0607.schema.oua_force_order.sql |   23 ++++++++++++++++++++
 3 files changed, 32 insertions(+), 12 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list