[open-ils-commits] r16496 - trunk/Open-ILS/src/sql/Pg/upgrade (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue May 25 13:53:47 EDT 2010


Author: scottmk
Date: 2010-05-25 13:53:43 -0400 (Tue, 25 May 2010)
New Revision: 16496

Modified:
   trunk/Open-ILS/src/sql/Pg/upgrade/0274.data.org-setting-type-est-wait.sql
Log:
Correcting an upgrade script.

The value column in actor.org_unit_setting should be valid JSON.  In this
revised version the new value is jiggered to make it a string instead of a
number.  This conversion is a bit simplistic and can be defeated by various
kinds of improbable input.

M    Open-ILS/src/sql/Pg/upgrade/0274.data.org-setting-type-est-wait.sql


Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0274.data.org-setting-type-est-wait.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0274.data.org-setting-type-est-wait.sql	2010-05-25 16:51:16 UTC (rev 16495)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0274.data.org-setting-type-est-wait.sql	2010-05-25 17:53:43 UTC (rev 16496)
@@ -11,7 +11,17 @@
 
 UPDATE actor.org_unit_setting SET
 	name = 'circ.holds.default_estimated_wait_interval',
-	value = value || ' days'
+	--
+	-- The value column should be JSON.  The old value should be a number,
+	-- but it may or may not be quoted.  The following CASE behaves
+	-- differently depending on whether value is quoted.  It is simplistic,
+	-- and will be defeated by leading or trailing white space, or various
+	-- malformations.
+	--
+	value = CASE WHEN SUBSTR( value, 1, 1 ) = '"'
+				THEN '"' || SUBSTR( value, 2, LENGTH(value) - 2 ) || ' days"'
+				ELSE '"' || value || ' days"'
+			END
 WHERE name = 'circ.hold_estimate_wait_interval';
 
 INSERT INTO config.org_unit_setting_type (



More information about the open-ils-commits mailing list