Changeset 1534


Ignore:
Timestamp:
Feb 17, 2011, 3:29:16 PM (6 years ago)
Author:
t.w.abma@…
Message:
  • added check to database upgrade SQL query to drop constraint for field name in MappingColumn?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/DatabaseUpgrade.groovy

    r1532 r1534  
    184184           if (db == "org.postgresql.Driver") {
    185185                   try {
    186                            sql.execute("ALTER TABLE mapping_column DROP CONSTRAINT mapping_column_name_key")
     186                // Check if constraint still exists
     187                if (sql.firstRow("SELECT * FROM pg_constraint WHERE contype='mapping_column_name_key"))
     188                    sql.execute("ALTER TABLE mapping_column DROP CONSTRAINT mapping_column_name_key")
     189                else
     190                    println "changeMappingColumnNameConstraint exiting, constraint doesn't exist"
     191
    187192                   } catch (Exception e) {
    188193                           println "changeMappingColumnNameConstraint `name` field unique constraint couldn't be dropped: " + e.getMessage()
Note: See TracChangeset for help on using the changeset viewer.