Hi I'm trying something very simple with Grails domain class. I am adding to my class a field and I want to use data migration plugin to rollback once so that the field I added gets removed.
First I created the initial change log as followed:
grails dbm-generate-changelog changelog.groovy
Then I added the following to the Config.groovy file:
grails.plugin.databasemigration.updateOnStart = true grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
Then I added an extra field to my domain class and performed the following:
grails dbm-gorm-diff added-new-field.groovy --add
I ran the app (grails run-app), after which I perform a:
grails dbm-rollback-count 1
After which I run the app again using: grails run-app but the field is still there.
I am using MySQL for db. Here's how I have it configured in DataSource.groovy:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = 'update'
url = "jdbc:mysql://localhost/dashboard?useUnicode=yes&characterEncoding=UTF-8"
username ="foo"
password = "bar"
}
}
..... and on.....
Can someone guide me to how the rollback is performed? I am using: Grails 2.2.2 database-migration:1.3.2
dbCreate = ''- Kamil Mikolajczyk