LP#1671150 Stamp database upgrade script.
authorJason Stephenson <jason@sigio.com>
Fri, 17 Nov 2017 20:15:15 +0000 (15:15 -0500)
committerJason Stephenson <jason@sigio.com>
Fri, 17 Nov 2017 20:15:15 +0000 (15:15 -0500)
Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/sql/Pg/upgrade/1083.scema.qualify_unaccent_refs.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.qualify_unaccent_refs.sql [deleted file]

index d821d84..efac8d3 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 ('1082', :eg_version); -- jboyer/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1083', :eg_version); -- jeff/dyrcona
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1083.scema.qualify_unaccent_refs.sql b/Open-ILS/src/sql/Pg/upgrade/1083.scema.qualify_unaccent_refs.sql
new file mode 100644 (file)
index 0000000..46a7c08
--- /dev/null
@@ -0,0 +1,31 @@
+-- Evergreen DB patch XXXX.schema.qualify_unaccent_refs.sql
+-- LP#1671150 Fix unaccent() function call in evergreen.unaccent_and_squash()
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('1083', :eg_version);
+CREATE OR REPLACE FUNCTION evergreen.unaccent_and_squash ( IN arg text) RETURNS text
+        BEGIN
+        RETURN evergreen.lowercase(public.unaccent('public.unaccent', regexp_replace(arg, '[\s[:punct:]]','','g')));
+        END;
+-- Drop indexes if present, so that we can re-create them
+DROP INDEX IF EXISTS actor.actor_usr_first_given_name_unaccent_idx;
+DROP INDEX IF EXISTS actor.actor_usr_second_given_name_unaccent_idx;
+DROP INDEX IF EXISTS actor.actor_usr_family_name_unaccent_idx; 
+DROP INDEX IF EXISTS actor.actor_usr_usrname_unaccent_idx; 
+-- Create (or re-create) indexes -- they may be missing if pg_restore failed to create
+-- them due to the previously unqualified call to unaccent()
+CREATE INDEX actor_usr_first_given_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(first_given_name));
+CREATE INDEX actor_usr_second_given_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(second_given_name));
+CREATE INDEX actor_usr_family_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(family_name));
+CREATE INDEX actor_usr_usrname_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(usrname));
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.qualify_unaccent_refs.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.qualify_unaccent_refs.sql
deleted file mode 100644 (file)
index 5a73f4b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
--- Evergreen DB patch XXXX.schema.qualify_unaccent_refs.sql
--- LP#1671150 Fix unaccent() function call in evergreen.unaccent_and_squash()
--- check whether patch can be applied
--- FIXME: uncomment when we have an upgrade number
--- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-CREATE OR REPLACE FUNCTION evergreen.unaccent_and_squash ( IN arg text) RETURNS text
-        BEGIN
-        RETURN evergreen.lowercase(public.unaccent('public.unaccent', regexp_replace(arg, '[\s[:punct:]]','','g')));
-        END;
--- Drop indexes if present, so that we can re-create them
-DROP INDEX IF EXISTS actor.actor_usr_first_given_name_unaccent_idx;
-DROP INDEX IF EXISTS actor.actor_usr_second_given_name_unaccent_idx;
-DROP INDEX IF EXISTS actor.actor_usr_family_name_unaccent_idx; 
-DROP INDEX IF EXISTS actor.actor_usr_usrname_unaccent_idx; 
--- Create (or re-create) indexes -- they may be missing if pg_restore failed to create
--- them due to the previously unqualified call to unaccent()
-CREATE INDEX actor_usr_first_given_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(first_given_name));
-CREATE INDEX actor_usr_second_given_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(second_given_name));
-CREATE INDEX actor_usr_family_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(family_name));
-CREATE INDEX actor_usr_usrname_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(usrname));