Monday, September 16, 2013

GRAILS Liquibase migration - add unique constraint

Below snippet of groovy code shows how to add a unique constraint using GRAILS and liquibase.
databaseChangeLog = {
    changeSet(author: "myname", id: "1234567890") {
  addUniqueConstraint(columnNames: "COL_NAME", constraintName: "SYS_C00123", deferrable: "false", disabled: "false", initiallyDeferred: "false", tableName: "TABLE_NAME")
 }
}