[open-ils-commits] r17645 - trunk/Open-ILS/src/sql/Pg/upgrade (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Sep 14 09:27:10 EDT 2010
Author: scottmk
Date: 2010-09-14 09:27:09 -0400 (Tue, 14 Sep 2010)
New Revision: 17645
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql
Log:
Fix a function that moves translations in config.i18n_core,
so that it will handle both text-based keys and numeric keys.
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0395.schema.fix-i18n-fixer.sql 2010-09-14 13:27:09 UTC (rev 17645)
@@ -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;
More information about the open-ils-commits
mailing list