Stamping upgrade script for Vandelay on PG10
authorJason Boyer <jboyer@library.in.gov>
Wed, 8 May 2019 14:43:02 +0000 (10:43 -0400)
committerJason Boyer <jboyer@library.in.gov>
Wed, 8 May 2019 14:43:02 +0000 (10:43 -0400)
Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql [deleted file]

index 7abca1e..93f7ea7 100644 (file)
@@ -92,7 +92,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 ('1162', :eg_version); -- berick/Bmagic
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1163', :eg_version); -- JBoyer/Dyrcona/bshum/JBoyer
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql b/Open-ILS/src/sql/Pg/upgrade/1163.schema.lp1820339-pg10-vandelay.sql
new file mode 100644 (file)
index 0000000..d9dd6e3
--- /dev/null
@@ -0,0 +1,34 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1163', :eg_version); -- JBoyer/Dyrcona/bshum/JBoyer
+
+CREATE OR REPLACE FUNCTION vandelay.flatten_marc_hstore(
+    record_xml TEXT
+) RETURNS HSTORE AS $func$
+BEGIN
+    RETURN (SELECT
+        HSTORE(
+            ARRAY_AGG(tag || (COALESCE(subfield, ''))),
+            ARRAY_AGG(value)
+        )
+        FROM (
+            SELECT  tag, subfield, ARRAY_AGG(value)::TEXT AS value
+              FROM  (SELECT tag,
+                            subfield,
+                            CASE WHEN tag = '020' THEN -- caseless -- isbn
+                                LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{10,17})$$))[1] || '%')
+                            WHEN tag = '022' THEN -- caseless -- issn
+                                LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
+                            WHEN tag = '024' THEN -- caseless -- upc (other)
+                                LOWER(value || '%')
+                            ELSE
+                                value
+                            END AS value
+                      FROM  vandelay.flatten_marc(record_xml)) x
+                GROUP BY tag, subfield ORDER BY tag, subfield
+        ) subquery
+    );
+END;
+$func$ LANGUAGE PLPGSQL;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1820339-pg10-vandelay.sql
deleted file mode 100644 (file)
index 86b18ea..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION vandelay.flatten_marc_hstore(
-    record_xml TEXT
-) RETURNS HSTORE AS $func$
-BEGIN
-    RETURN (SELECT
-        HSTORE(
-            ARRAY_AGG(tag || (COALESCE(subfield, ''))),
-            ARRAY_AGG(value)
-        )
-        FROM (
-            SELECT  tag, subfield, ARRAY_AGG(value)::TEXT AS value
-              FROM  (SELECT tag,
-                            subfield,
-                            CASE WHEN tag = '020' THEN -- caseless -- isbn
-                                LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{10,17})$$))[1] || '%')
-                            WHEN tag = '022' THEN -- caseless -- issn
-                                LOWER((SELECT REGEXP_MATCHES(value,$$^(\S{4}[- ]?\S{4})$$))[1] || '%')
-                            WHEN tag = '024' THEN -- caseless -- upc (other)
-                                LOWER(value || '%')
-                            ELSE
-                                value
-                            END AS value
-                      FROM  vandelay.flatten_marc(record_xml)) x
-                GROUP BY tag, subfield ORDER BY tag, subfield
-        ) subquery
-    );
-END;
-$func$ LANGUAGE PLPGSQL;
-
-COMMIT;