Stamping upgrade for accent-ignoring patron search
authorMike Rylander <mrylander@gmail.com>
Tue, 9 Aug 2016 16:41:54 +0000 (12:41 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 9 Aug 2016 16:41:54 +0000 (12:41 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0986.schema.patron_unaccent.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron_unaccent.sql [deleted file]

index 27f5d85..8e08b18 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 ('0985', :eg_version); -- dbwells/gmcharlt/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0986', :eg_version); -- dpearl/dyrcona/miker
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0986.schema.patron_unaccent.sql b/Open-ILS/src/sql/Pg/upgrade/0986.schema.patron_unaccent.sql
new file mode 100644 (file)
index 0000000..7fb0465
--- /dev/null
@@ -0,0 +1,43 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0986', :eg_version);
+
+CREATE EXTENSION IF NOT EXISTS unaccent SCHEMA public;
+
+CREATE OR REPLACE FUNCTION evergreen.unaccent_and_squash ( IN arg text) RETURNS text
+    IMMUTABLE STRICT AS $$
+       BEGIN
+       RETURN evergreen.lowercase(unaccent(regexp_replace(arg, '\s','','g')));
+       END;
+$$ LANGUAGE PLPGSQL;
+
+-- The unaccented indices for patron name fields
+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));
+
+-- DB setting to control behavior; true by default
+INSERT INTO config.org_unit_setting_type
+( name, grp, label, description, datatype )
+VALUES
+('circ.patron_search.diacritic_insensitive',
+ 'circ',
+ oils_i18n_gettext('circ.patron_search.diacritic_insensitive',
+     'Patron search diacritic insensitive',
+     'coust', 'label'),
+ oils_i18n_gettext('circ.patron_search.diacritic_insensitive',
+     'Match patron last, first, and middle names irrespective of usage of diacritical marks or spaces. (e.g., Ines will match Inés; de la Cruz will match Delacruz)',
+     'coust', 'description'),
+  'bool');
+
+INSERT INTO actor.org_unit_setting (
+    org_unit, name, value
+) VALUES (
+    (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
+    'circ.patron_search.diacritic_insensitive',
+    'true'
+);
+
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron_unaccent.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron_unaccent.sql
deleted file mode 100644 (file)
index 3ec260b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE EXTENSION IF NOT EXISTS unaccent SCHEMA public;
-
-CREATE OR REPLACE FUNCTION evergreen.unaccent_and_squash ( IN arg text) RETURNS text
-    IMMUTABLE STRICT AS $$
-       BEGIN
-       RETURN evergreen.lowercase(unaccent(regexp_replace(arg, '\s','','g')));
-       END;
-$$ LANGUAGE PLPGSQL;
-
--- The unaccented indices for patron name fields
-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));
-
--- DB setting to control behavior; true by default
-INSERT INTO config.org_unit_setting_type
-( name, grp, label, description, datatype )
-VALUES
-('circ.patron_search.diacritic_insensitive',
- 'circ',
- oils_i18n_gettext('circ.patron_search.diacritic_insensitive',
-     'Patron search diacritic insensitive',
-     'coust', 'label'),
- oils_i18n_gettext('circ.patron_search.diacritic_insensitive',
-     'Match patron last, first, and middle names irrespective of usage of diacritical marks or spaces. (e.g., Ines will match Inés; de la Cruz will match Delacruz)',
-     'coust', 'description'),
-  'bool');
-
-INSERT INTO actor.org_unit_setting (
-    org_unit, name, value
-) VALUES (
-    (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
-    'circ.patron_search.diacritic_insensitive',
-    'true'
-);
-
-
-COMMIT;
-