Grails 数据库迁移插件

标签 grails grails-orm liquibase

我正在尝试更改我的数据库模型,所以我关注了 this教程。顺便说一句,我正在使用 Grails 1.3.7。

我跑了:

grails install-plugin database-migration

它安装得很好!

但是当我跑的时候:
dbm-generate-gorm-changelog changelog.groovy

它给了我以下错误:
java.io.FileNotFoundException: grails-app\migrations\changelog.groovy (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at java.io.FileWriter.<init>(FileWriter.java:90)
at _DatabaseMigrationCommon_groovy$_run_closure7.doCall(_DatabaseMigrationCommon_groovy:128)
at _DatabaseMigrationCommon_groovy$_run_closure7.call(_DatabaseMigrationCommon_groovy)
at DbmGenerateGormChangelog$_run_closure1_closure2.doCall(DbmGenerateGormChangelog:28)
at DbmGenerateGormChangelog$_run_closure1_closure2.doCall(DbmGenerateGormChangelog)
at _DatabaseMigrationCommon_groovy$_run_closure6_closure18.doCall(_DatabaseMigrationCommon_groovy:88)
at _DatabaseMigrationCommon_groovy$_run_closure6_closure18.doCall(_DatabaseMigrationCommon_groovy)
at grails.plugin.databasemigration.MigrationUtils.executeInSession(MigrationUtils.groovy:99)
at grails.plugin.databasemigration.MigrationUtils$executeInSession.call(Unknown Source)
at _DatabaseMigrationCommon_groovy$_run_closure6.doCall(_DatabaseMigrationCommon_groovy:81)
at _DatabaseMigrationCommon_groovy$_run_closure6.call(_DatabaseMigrationCommon_groovy)
at DbmGenerateGormChangelog$_run_closure1.doCall(DbmGenerateGormChangelog:27)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)

最佳答案

您可能缺少“--add”:

dbm-generate-gorm-changelog --add changelog.groovy

Grails 数据库迁移的绝佳入口点(由 grails 团队提供):http://blog.springsource.org/2011/08/17/countdown-to-grails-2-0-database-migrations/

关于Grails 数据库迁移插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9792570/

相关文章:

grails - 基于gsp文件自动创建对象

mongodb - 如何在不使用_id的情况下创建mongodb集合

mysql - Grails 子查询

rest - 在 grails 中将 transient 域类属性作为 restful json 或 xml 响应包括在内

grails - 在多对多Szenario中查找对象-Grails

Grails 异步执行多个原生 sql 查询

database - 在现有数据库上使用 liquibase

mysql - Liquibase初学者: making a ManyToMany association bidirectional

Liquibase 包含上下文

grails - 将访问权限升级为Grails,将Spring Security core升级到2.0版本后,访问被拒绝,对不起,您无权查看此页面