Changeset 1403
- Timestamp:
- Jan 18, 2011, 10:46:12 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/DatabaseUpgrade.groovy
r1365 r1403 31 31 changeStudyDescription(sql, db) // r1245 / r1246 32 32 changeStudyDescriptionToText(sql, db) // r1327 33 changeTemplateTextFieldSignatures(sql, db) // prevent Grails issue, see http://jira.codehaus.org/browse/GRAILS-6754 33 34 } 34 35 … … 101 102 } 102 103 } 104 105 public static void changeTemplateTextFieldSignatures(sql, db) { 106 if (db == "org.postgresql.Driver") { 107 // check if any TEXT template fields are of type 'text' 108 sql.eachRow("SELECT columns.table_name FROM information_schema.columns WHERE columns.table_schema::text = 'public'::text AND column_name='template_text_fields_elt' AND data_type != 'text';") 109 { row -> 110 "performing database upgrade: ${row.table_name} template_text_fields_string/elt to text".grom() 111 try { 112 // change the datatype of study::description to text 113 sql.execute("ALTER TABLE ${row.table_name} ALTER COLUMN template_text_fields_elt TYPE text") 114 sql.execute("ALTER TABLE ${row.table_name} ALTER COLUMN template_text_fields_string TYPE text") 115 116 } catch (Exception e) { 117 "changeTemplateTextFieldSignatures database upgrade failed: " + e.getMessage() 118 } 119 } 120 } 121 } 103 122 }
Note: See TracChangeset
for help on using the changeset viewer.