大家好,我遇到了grails数据库迁移插件的问题/混淆。
用于学习的资源-
现在,在这些帮助下,我能够很好地迁移或更改本地机器上的数据库,该机器已经安装并正确工作。
问题是生产服务器是在线部署的,我总是上传我的WAR文件以便部署在apache上。所以它基本上是在JAVA上运行的,所以grails没有安装在ubuntu机器上。现在我将如何在服务器上迁移mysql数据库?
发布于 2014-07-31 07:31:48
在Config.groovy文件中添加下面的配置。迁移将在战争部署期间运行。
//===========================DATA MIGRATION============================
//Run changelog.groovy during application deployment on server?
grails.plugin.databasemigration.updateOnStart = true
//File used to run the db migration scripts
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
//Absolute path of changelog.groovy in the app base dir
grails.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.groovychangelog.groovy
databaseChangeLog = {
include file: 'migration1.groovy'
include file: 'migration2.groovy'
} https://stackoverflow.com/questions/25053091
复制相似问题