Deprecation of Clean On Validation Error
Published 09 September 2024
In Flyway engine, cleanOnValidationError is a parameter used as a convenience to clean your development databases if an error occurs during validation.
With the legacy configuration files, development and production databases were stored in separate configuration files, so setting cleanOnValidationError would only clean that the database the configuration file represented.
When using TOML for configuration, multiple environments can be described in a single configuration file, including both development and production environments. If the parameter is set within the Flyway namespace any environment that was running would be cleaned if an error occurred, including non development databases.
For this reason, we have decided to deprecate cleanOnValidationError.
If this functionality is required, it can be duplicated using a bash script:
flyway validate
if [ $? -ne 0 ]; then
flyway clean
fi
where validate returns a non-zero code then runs flyway clean.
We will start warning about the deprecation from Flyway v10.17.x with a plan to remove in v11