[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. cccb3df5931b4da2284b4fb17c21c1d1be5511cf

Evergreen Git git at git.evergreen-ils.org
Tue Aug 23 14:39:47 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, rel_2_1 has been updated
       via  cccb3df5931b4da2284b4fb17c21c1d1be5511cf (commit)
       via  ccf8d121497cf16c288d74b1ed147dfb2d1c43b9 (commit)
       via  7597eabf7881bcb2fae989a00fddff6a451a69d4 (commit)
       via  2cb3b3d1c9ee48b34bc5fce74bb403582bebb92c (commit)
      from  fffe9d65e508dc998356de104f5a372857e167b6 (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 cccb3df5931b4da2284b4fb17c21c1d1be5511cf
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Aug 23 14:34:55 2011 -0400

    2.[01]-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 da85225..5283d98 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0605'); -- dbwells/dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0607'); -- miker/jamesrf/tsbere
 
 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 87%
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..7a1afd6 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,7 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0607');
+
 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 +13,5 @@ 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 ccf8d121497cf16c288d74b1ed147dfb2d1c43b9
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 964e4c5..8dfd8a2 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 7597eabf7881bcb2fae989a00fddff6a451a69d4
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 2cb3b3d1c9ee48b34bc5fce74bb403582bebb92c
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 8c2c1a2..964e4c5 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 |   17 +++++++++++++++++
 3 files changed, 26 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