How do I modify a column using Grails' database migration plugin's Groovy DSL?

半城伤御伤魂 提交于 2019-12-04 07:08:54

All Liquibase refactorings should work - the Groovy DSL mirrors the Liquibase XML. I didn't have a test for modifyDataType but added it to my test script and it worked fine - see https://github.com/grails-plugins/grails-database-migration/blob/master/testapp/price.changelog.groovy

It'd be useful to figure out what's wrong if you could show some information about how it fails.

It will work like this:

databaseChangeLog = {

  changeSet(author: "test (generated)", id: "1422541392309-2") {
    comment { 'Rename tabTitle to tabName' }
    renameColumn(tableName: "user", oldColumnName: "tab_title", newColumnName: "tab_name", columnDataType: "varchar(255)")
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!