Was ist ein guter Workflow für die Datenbankmigration in Grails?
Ich möchte das benutzenDatenbank-Migration Grails-Plugin für die Datenbankmigration. Wenn ich meine Grails-App zum ersten Mal starte, werden alle Datenbanktabellen automatisch erstellt. Die Produktionseinstellung in meiner DataSource.groovy ist:
production {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost/myapp?useUnicode=yes&characterEncoding=UTF-8"
username = "test"
password = "test"
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
properties {
validationQuery = "select 1"
testWhileIdle = true
timeBetweenEvictionRunsMillis = 60000
}
}
}
In meinem config.groovy habe ich eingestellt:
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
Wenn ich meinen Domänenklassen Eigenschaften hinzufüge, muss ich die Changelog-Datei anpassen. Wie kann in diesem Fall die Datenbankmigration am besten durchgeführt werden? Was muss ich tun, wenn ich Spalten hinzufüge oder entferne?