如何在Grails中使用db-migrate更改列类型?

时间:2013-08-05 12:25:20

标签: spring grails grails-2.0 grails-domain-class liquibase

我正在使用Grails 2.2.4和db-migrate插件1.3.5。我的数据库是mysql。

与数据库同步的现有模型是:

 class User {
    String description
 }

Hibernate在mysql中创建了一个varchar(255)。我需要一个更长的文本列,所以我做了:

 class User {
    String description

static mapping = {
    description type: 'text'
}
 }

然后我运行了dbm-gorm-diff change-column.groovy -add

并收到以下错误。我该怎么办?

| Starting dbm-gorm-diff
| Error org.hibernate.MappingException: No Dialect mapping for JDBC type: 7
| Error     at grails.plugin.databasemigration.GormDiff.areEquivalent(GormDiff.groovy:146)
| Error     at grails.plugin.databasemigration.GormDiff.isDifferent(GormDiff.groovy:114)
| Error     at grails.plugin.databasemigration.GormDiff.compare(GormDiff.groovy:68)
| Error     at grails.plugin.databasemigration.ScriptUtils.createAndPrintFixedDiff(ScriptUtils.groovy:244)
| Error     at DbmGormDiff$_run_closure1_closure2_closure3.doCall(DbmGormDiff:53)
| Error     at grails.plugin.databasemigration.MigrationUtils.executeInSession(MigrationUtils.groovy:132)
| Error     at DbmGormDiff$_run_closure1_closure2.doCall(DbmGormDiff:50)
| Error     at grails.plugin.databasemigration.ScriptUtils.executeAndWrite(ScriptUtils.groovy:104)
| Error     at DbmGormDiff$_run_closure1.doCall(DbmGormDiff:49)

2 个答案:

答案 0 :(得分:0)

@raxith评论后,使用dbm1.3.21.3.8升级到grails 2.2.5为我工作

答案 1 :(得分:-1)

您可以将其更改为sqlType以使dbm-gorm-diff运行。然后再改回来。关于插件的这种类型的错误,有几个JIRA问题。