gradlew update
gradlew update -Penv=preprod
gradlew db:rollbackCount -PliquibaseCommandValue=xx
xx
is number you want to rollback, If current id is5
, whenxx = 2
that mean the sql will rollback toid = 3
Open file build.gradle
in the lines :
liquibase {
activities {
dev {
changeLogFile changeLog
url 'jdbc:mysql://localhost:3306/foo_test?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8'
username 'root'
password 'root'
}
runList = "$env".isEmpty() ? "dev" : "$env"
}
}
you can add more environment as bellow:
dev {
changeLogFile changeLog
.....
preprod {
changeLogFile changeLog
url 'jdbc:mysql://mysq-server:3306/my_database?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8'
username 'mysqlusername'
password 'mysqlpass'
}
.......... another environment
runList = "$env".isEmpty() ? "dev" : "$env"
}
}