Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Migrasi basis data Grails di server yang digunakan

Tambahkan konfigurasi di bawah ini di file Config.groovy Anda. Migrasi akan berjalan selama penerapan 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
//=====================================================================

Berdasarkan konfigurasi di atas, beginilah seharusnya struktur folder Anda:

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

changelog.groovy

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



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Transaksi di MySQL - Tidak Dapat Mengembalikan

  2. Mengonversi rentang tanggal PHP ke tanggal individu MYSQL

  3. Bagaimana menerapkan Pencarian Kata Kunci di MySQL?

  4. MySQL - Jadikan Bidang yang Ada Unik

  5. Apa itu PANJANG () di MySQL?