Migrating a Grails Database to a Deployed Server

Hi everyone, I am facing a problem / confusion with the Grails database migration plugin.

Resources used for learning -

Now, with their help, I can very well migrate or make changes to my database on the local computer on which graphite is installed and running.

The problem is that the production server is deployed on the network, and I always upload my WAR file for deployment on apache tomcat. Thus, it mainly runs on JAVA, so grails is not installed on the ubuntu machine. Now, how can I transfer the mysql database to the server?

+4
source share
1 answer

Add the config below to the Config.groovy file. Migration will occur during the deployment of WAR.

//===========================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
//=====================================================================

Based on the configuration above, here is what your folder structure looks like:

your-grails-project
      --migrations/
          --changelog.groovy
          --migration1.groovy
          --migration2.groovy

changelog.groovy

databaseChangeLog = { 
  include file: 'migration1.groovy'
  include file: 'migration2.groovy'
}    
+4
source

Source: https://habr.com/ru/post/1535291/


All Articles