From 1104e5158bbcff1c81a5e57d2170786bbd7ba0ae Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Mon, 22 Aug 2011 14:44:17 -0400 Subject: [PATCH] Reverse direction of org_unit_ancestors Apparently callers expect it to start at the top of the org tree. Signed-off-by: Thomas Berezansky Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/020.schema.functions.sql | 2 +- Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql index ff8751ee76..1f78468b40 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 84d864b452..9e146395cd 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; -- 2.11.0