LP 1150458 DB upgrade stamping
authorBill Erickson <berick@esilibrary.com>
Wed, 20 Mar 2013 20:42:10 +0000 (16:42 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 20 Mar 2013 20:46:47 +0000 (16:46 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate [deleted file]

index e9bc0e2..8d86600 100644 (file)
@@ -91,7 +91,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 ('0783', :eg_version); -- gmcharlt/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0784', :eg_version); -- Callender/berick
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql b/Open-ILS/src/sql/Pg/upgrade/0784.schema.axis_authority_tags_refs_aggregate.sql
new file mode 100644 (file)
index 0000000..512078a
--- /dev/null
@@ -0,0 +1,39 @@
+-- Evergreen DB patch XXXX.function.axis_authority_tags_refs_aggregate.sql
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0784', :eg_version);
+
+CREATE OR REPLACE FUNCTION authority.axis_authority_tags_refs(a TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+       SELECT  unnest(ARRAY_CAT(
+                 ARRAY[a.field],
+                 (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.field)
+             )) y
+       FROM  authority.browse_axis_authority_field_map a
+       WHERE axis = $1) x;
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION authority.btag_authority_tags_refs(btag TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.authority_field],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.authority_field)
+                )) y
+      FROM  authority.control_set_bib_field a
+      WHERE a.tag = $1) x
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION authority.atag_authority_tags_refs(atag TEXT) RETURNS INT[] AS $$
+    SELECT ARRAY_AGG(y) from (
+        SELECT  unnest(ARRAY_CAT(
+                    ARRAY[a.id],
+                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.id)
+                )) y
+      FROM  authority.control_set_authority_field a
+      WHERE a.tag = $1) x
+$$ LANGUAGE SQL;
+
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.axis_authority_tags_refs_aggregate
deleted file mode 100644 (file)
index 5a2dcc9..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
--- Evergreen DB patch XXXX.function.axis_authority_tags_refs_aggregate.sql
---
-BEGIN;
-
--- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION authority.axis_authority_tags_refs(a TEXT) RETURNS INT[] AS $$
-    SELECT ARRAY_AGG(y) from (
-       SELECT  unnest(ARRAY_CAT(
-                 ARRAY[a.field],
-                 (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.field)
-             )) y
-       FROM  authority.browse_axis_authority_field_map a
-       WHERE axis = $1) x;
-$$ LANGUAGE SQL;
-
-CREATE OR REPLACE FUNCTION authority.btag_authority_tags_refs(btag TEXT) RETURNS INT[] AS $$
-    SELECT ARRAY_AGG(y) from (
-        SELECT  unnest(ARRAY_CAT(
-                    ARRAY[a.authority_field],
-                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.authority_field)
-                )) y
-      FROM  authority.control_set_bib_field a
-      WHERE a.tag = $1) x
-$$ LANGUAGE SQL;
-
-CREATE OR REPLACE FUNCTION authority.atag_authority_tags_refs(atag TEXT) RETURNS INT[] AS $$
-    SELECT ARRAY_AGG(y) from (
-        SELECT  unnest(ARRAY_CAT(
-                    ARRAY[a.id],
-                    (SELECT ARRAY_ACCUM(x.id) FROM authority.control_set_authority_field x WHERE x.main_entry = a.id)
-                )) y
-      FROM  authority.control_set_authority_field a
-      WHERE a.tag = $1) x
-$$ LANGUAGE SQL;
-
-
-COMMIT;