Changeset 2228


Ignore:
Timestamp:
May 8, 2012, 4:57:55 PM (5 years ago)
Author:
work@…
Message:

Resolved issue #51: Changed ontology description type to 'text' (instead of varchar 22) in GDT 0.2.1

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/application.properties

    r2226 r2228  
    1212plugins.crypto=2.0
    1313plugins.famfamfam=1.0.1
    14 plugins.gdt=0.2.0
     14plugins.gdt=0.2.1
    1515plugins.gdtimporter=0.4.6.7
    1616plugins.grails-melody=1.11
  • trunk/grails-app/conf/dbnp/configuration/DatabaseUpgrade.groovy

    r2089 r2228  
    4343                                                        // GdtImporter now by default uses 'columnindex' as domain field name
    4444                fixShibbolethSecUser(sql, db)                                   // fix shibboleth user
     45        changeOntologyDescriptionType(sql, db)          // change ontology description type to text
    4546        }
    4647
     
    426427                }
    427428        }
     429
     430    /**
     431     * Make sure the ontology's description is of type text instead of varchar
     432     * @param sql
     433     * @param db
     434     */
     435    public static void changeOntologyDescriptionType(sql, db) {
     436        // are we running postgreSQL?
     437        if (db == "org.postgresql.Driver") {
     438            if (sql.firstRow("SELECT * FROM information_schema.columns WHERE columns.table_name='study' AND columns.column_name='code' AND columns.data_type='character varying'")) {
     439                if (String.metaClass.getMetaMethod("grom")) "performing database upgrade: change ontology description type".grom()
     440
     441                try {
     442                    // change the datatype of the ontology's description to text
     443                    sql.execute("ALTER TABLE ontology ALTER COLUMN description TYPE text")
     444                } catch (Exception e) {
     445                    println "changeOntologyDescriptionType database upgrade failed: " + e.getMessage()
     446                }
     447            }
     448        }
     449   }
    428450}
Note: See TracChangeset for help on using the changeset viewer.