From: scottmk Date: Tue, 14 Sep 2010 13:27:09 +0000 (+0000) Subject: Fix a function that moves translations in config.i18n_core, X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=41243488db61ab6bfac0e8a8dca471ddb1aa9c11;p=evergreen%2Fbjwebb.git 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 --- 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;