LP 1438136: Stamping upgrade script.
authorJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 19:01:10 +0000 (15:01 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 19:01:10 +0000 (15:01 -0400)
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0940.schema.vlist_freq.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vlist_freq.sql [deleted file]

index 9aff082..d58b922 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 ('0939', :eg_version); -- mrpeters/stompro/mmorgan/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0940', :eg_version); -- miker/jboyer/csharp/dyrcona
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0940.schema.vlist_freq.sql b/Open-ILS/src/sql/Pg/upgrade/0940.schema.vlist_freq.sql
new file mode 100644 (file)
index 0000000..6e55e03
--- /dev/null
@@ -0,0 +1,37 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0939', :eg_version);
+
+CREATE OR REPLACE FUNCTION evergreen.pg_statistics (tab TEXT, col TEXT) RETURNS TABLE(element TEXT, frequency INT) AS $$
+BEGIN
+    -- This query will die on PG < 9.2, but the function can be created. We just won't use it where we can't.
+    RETURN QUERY
+        SELECT  e,
+                f
+          FROM  (SELECT ROW_NUMBER() OVER (),
+                        (f * 100)::INT AS f
+                  FROM  (SELECT UNNEST(most_common_elem_freqs) AS f
+                          FROM  pg_stats
+                          WHERE tablename = tab
+                                AND attname = col
+                        )x
+                ) AS f
+                JOIN (SELECT ROW_NUMBER() OVER (),
+                             e
+                       FROM (SELECT UNNEST(most_common_elems::text::text[]) AS e
+                              FROM  pg_stats 
+                              WHERE tablename = tab
+                                    AND attname = col
+                            )y
+                ) AS elems USING (row_number);
+END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION evergreen.query_int_wrapper (INT[],TEXT) RETURNS BOOL AS $$
+BEGIN
+    RETURN $1 @@ $2::query_int;
+END;
+$$ LANGUAGE PLPGSQL STABLE;
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vlist_freq.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.vlist_freq.sql
deleted file mode 100644 (file)
index a7b992b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION evergreen.pg_statistics (tab TEXT, col TEXT) RETURNS TABLE(element TEXT, frequency INT) AS $$
-BEGIN
-    -- This query will die on PG < 9.2, but the function can be created. We just won't use it where we can't.
-    RETURN QUERY
-        SELECT  e,
-                f
-          FROM  (SELECT ROW_NUMBER() OVER (),
-                        (f * 100)::INT AS f
-                  FROM  (SELECT UNNEST(most_common_elem_freqs) AS f
-                          FROM  pg_stats
-                          WHERE tablename = tab
-                                AND attname = col
-                        )x
-                ) AS f
-                JOIN (SELECT ROW_NUMBER() OVER (),
-                             e
-                       FROM (SELECT UNNEST(most_common_elems::text::text[]) AS e
-                              FROM  pg_stats 
-                              WHERE tablename = tab
-                                    AND attname = col
-                            )y
-                ) AS elems USING (row_number);
-END;
-$$ LANGUAGE PLPGSQL;
-
-CREATE OR REPLACE FUNCTION evergreen.query_int_wrapper (INT[],TEXT) RETURNS BOOL AS $$
-BEGIN
-    RETURN $1 @@ $2::query_int;
-END;
-$$ LANGUAGE PLPGSQL STABLE;
-
-COMMIT;
-