如何使用Grails的数据库迁移插件的Groovy DSL修改列? [英] How do I modify a column using Grails' database migration plugin's Groovy DSL?
问题描述
你可以给我一个使用 modifyDataType
方法的groovy变更集的例子吗?
Can you give me an example of a groovy changeset using the modifyDataType
method?
我试过这个:
I tried this:
databaseChangeLog = {
changeSet(author: "user", id: "5-1") {
modifyDataType(tableName: "test", columnName: "description4", newDataType: "int(11)")
}
}
但不能识别 modifyDataType
。我也尝试过 modifyColumn
,但我得到了同样的结果。
But modifyDataType
is not recognized. I also tried modifyColumn
, but I get the same result.
潜在的问题是:什么样的标签dsl支持,以及它们是如何使用的?
The underlying question is: What kind of tags does the dsl support, and how are they used?
推荐答案
所有Liquibase重构都应该工作 - Groovy DSL镜像Liquibase XML。我没有对modifyDataType进行测试,但将其添加到我的测试脚本中,并且它工作正常 - 请参阅 https://github.com/grails-plugins/grails-database-migration/blob/master/testapp/price.changelog.groovy
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.
这篇关于如何使用Grails的数据库迁移插件的Groovy DSL修改列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!