From 41243488db61ab6bfac0e8a8dca471ddb1aa9c11 Mon Sep 17 00:00:00 2001 From: scottmk Date: Tue, 14 Sep 2010 13:27:09 +0000 Subject: [PATCH] Fix a function that moves translations in config.i18n_core, so that it will handle both text-based keys and numeric keys. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17645 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql diff --git a/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql b/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql new file mode 100644 index 000000000..d91fb1aa7 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql @@ -0,0 +1,19 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0395'); -- Scott McKellar + +CREATE OR REPLACE FUNCTION oils_i18n_update_apply(old_ident TEXT, new_ident TEXT, hint TEXT) RETURNS VOID AS $_$ +BEGIN + + EXECUTE $$ + UPDATE config.i18n_core + SET identity_value = $$ || quote_literal( new_ident ) || $$ + WHERE fq_field LIKE '$$ || hint || $$.%' + AND identity_value = $$ || quote_literal( old_ident ) || $$;$$; + + RETURN; + +END; +$_$ LANGUAGE PLPGSQL; + +COMMIT; -- 2.11.0