在config.groovy文件中的config下面添加。迁移将在WAR部署期间运行。
//===========================DATA MIGRATION============================//Run changelog.groovy during application deployment on server?grails.plugin.databasemigration.updateonStart = true//File used to run the db migration scriptsgrails.plugin.databasemigration.updateonStartFileNames = ['changelog.groovy']//Absolute path of changelog.groovy in the app base dirgrails.plugin.databasemigration.changelogLocation = 'migrations'// the default schema to use when running auto-migrate on start//grails.plugin.databasemigration. updateonStartDefaultSchema ='schema' // You may not need this in MYSQL//=====================================================================
基于以上配置,这是文件夹结构应为的方式:
your-grails-project --migrations/ --changelog.groovy --migration1.groovy --migration2.groovy
changelog.groovy
databaseChangeLog = { include file: 'migration1.groovy' include file: 'migration2.groovy'}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)