2.[01]-stamped upgrade script for LP#816131
authorMike Rylander <mrylander@gmail.com>
Tue, 23 Aug 2011 18:34:55 +0000 (14:34 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 23 Aug 2011 18:34:55 +0000 (14:34 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.oua_force_order.sql [deleted file]

index da85225..5283d98 100644 (file)
@@ -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/0607.schema.oua_force_order.sql b/Open-ILS/src/sql/Pg/upgrade/0607.schema.oua_force_order.sql
new file mode 100644 (file)
index 0000000..7a1afd6
--- /dev/null
@@ -0,0 +1,17 @@
+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
+        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 DESC;
+$$ LANGUAGE SQL ROWS 1;
+
+COMMIT;
+
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
deleted file mode 100644 (file)
index 9e14639..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-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 DESC;
-$$ LANGUAGE SQL ROWS 1;
-