简体   繁体   中英

Grails db-migration plugin

I'm trying to change my database model, so I followed this tutorial. Btw I'm using Grails 1.3.7.

I ran:

grails install-plugin database-migration

It installed fine!

But when I ran:

dbm-generate-gorm-changelog changelog.groovy

It gave me the following error:

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)

you may be missing a "--add":

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

An excellent entry point to database-migration for grails (by grails' team): http://blog.springsource.org/2011/08/17/countdown-to-grails-2-0-database-migrations/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM