Grails 3 database-migration-plugin initialization error

雨燕双飞 提交于 2019-12-05 11:01:06

We ran into the same problem when upgrading to Grails 3.

A look into the code of the grails-database-migration plugin made clear that the configuration parameter is changed from a list updateOnStartFileNames to a single value updateOnStartFileName.

So when you change your config from

grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']

to

grails.plugin.databasemigration.updateOnStartFileName = 'changelog.xml'

it should work again.

I ran into a similar error. In my case we had some lookup tables where we were populating using a hand crafted script which was included into the main changelog.groovy like:

include file: 'data/001-tablex-data.groovy'

except the file name was incorrect - it should have been 002-... instead. The error is basically the same, but there is no reporting to indicate which included file is not being found/parsed, which is a pain. So if you have manually included files, then look for incorrectly named ones in addition to checking the top-level changelog.groovy or changelog.xml

Ok, I finally found a solution. Maybe it will help someone someday. So what I did was simply delete changelog.groovy (i switched from XML to Groovy) file. Then I generated a new one with $grails dbm-create-changelog changelog.groovycommand. As a final step I run $grails dbm-changelog-sync and everything started to work just fine.

Make sure:

  1. You have set up the changelog, i.e., the file grails-app/migrations/changelog.xml exists and is valid.

How you do this depends on your situation. The plugin's documentation has a section for how to create the file initially.

  1. Your datasource is set up to use the database that changelog.xml applies to.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!