Assuming the changelog is specified in grails-app/conf/liquibase/master.xml
resources.groovy
if (config.liquibase.on) {
liquibaseDropAll(LiquibaseDropAll) { bean ->
dataSource = dataSource
changeLog = "classpath:liquibase/master.xml"
bean.initMethod = 'init'
}
liquibase(SpringLiquibase) { bean ->
dataSource = dataSource
changeLog = "classpath:liquibase/master.xml"
bean.dependsOn = ['liquibaseDropAll']
}
}
LiquibaseDropAll.groovy
import liquibase.spring.SpringLiquibase
import org.codehaus.groovy.grails.commons.ConfigurationHolder
class LiquibaseDropAll extends SpringLiquibase {
void init() {
if (ConfigurationHolder.config.liquibase.dropAll) {
super.createLiquibase(dataSource.connection).dropAll()
}
}
}
Disclaimer: I've only just started using it so it may still thow up some gotchas.
No comments:
Post a Comment