IMHO setting the requireForce
via environment variable does not make sense.
I want to have it active ALWAYS.
So that the application will never drop my database unless I actively set force=true
.
As Spring Boot unfortunately does not support the requireForce
parameter, I set it like so:
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
System.setProperty("liquibase.command.dropAll.requireForce", "true");
SpringApplication.run(MyApplication.class, args);
}
}
Then in my run configuration for my dev environment I can add -Dliquibase.command.dropAll.force=true
.
This way, when I have spring.liquibase.drop-first=true
in my properties in my production environment, my application startup will ALWAYS fail instead of dropping my production database.