Redgate Flyway

Error running flyway check: Clean is disabled

Versions of flyway prior to 11.0.0 would clean the specified build environment, regardless of whether the cleanDisabled  parameter was set to false. Since flyway version 11.0.0 the check command now requires that the build environment either has a provisioner specified or has cleanDisabled=false specified. It's good practice to specify a provisioner for the build environment to make explicit the fact that flyway manages this environment.

Without specifying a provisioner for the build environment you may see an error like the one below when running the check command:

PS C:\Users\flyway\Documents\FlywayProjects\OracleProject> flyway check -changes "-check.buildEnvironment=shadow" -environment=prod
WARNING: You have set the legacy LicenseKey parameter - this is planned for deprecation in a future major release so please look at an updated licensing mechanism - https://rd.gt/4e3vEWk
Flyway Enterprise Edition 11.0.0 by Redgate
Licensed to red-gate.com (license ID 1174ed6b-b10e-41bd-9a1b-285ddc3239c7)
Flyway permit on disk is outdated and cannot be refreshed automatically because there is no refresh token on disk. Please rerun auth

See release notes here: https://rd.gt/416ObMi
WARNING: No provisioner is configured for build environment: shadow.
Please configure a provisioner for the build environment to ensure check works as expected.
Attempting to temporarily configure the build environment to use the clean provisioner.
A Flyway report has been generated here: C:\Users\richard.burke\OneDrive - Redgate\Documents\FlywayProjects\OracleOptions\report.html
ERROR: Clean is disabled - unable to configure clean provisioner. Please configure a provisioner for the shadow environment
PS C:\Users\flyway\Documents\FlywayProjects\OracleProject>

Two resolve this error one of two approaches can be taken:

Specify a provisioner for the build environment

The provisioner option for an environment can be specified in the toml or as a command line argument. The clean provisioner is normally used with a build environment, as it allows flyway to empty the build database of objects in order to run commands like check. The example below shows how the shadow environment can be configured with the clean provisioner using toml:

[environments.shadow]
url = "jdbc:oracle:thin:@//localhost:1521/XE"
user = "SYSTEM"
password = "..."
schemas = [ "INVENTORY" ]
provisioner = "clean"

Or equivalently over the CLI:

-environments.shadow.url="jdbc:oracle:thin:@//localhost:1521/XE"
-environments.shadow.user="SYSTEM"
-environments.shadow.password="..."
-environments.shadow.schemas="INVENTORY"
-environments.shadow.provisioner="clean"

Note: If you configure the build environment using the check.buildUrl, check.buildUser and check.buildPassword options then you will need to use the cleanDisabled  approach described below.

Specify the cleanDisabled parameter

Setting the cleanDisabled parameter to false allows flyway to execute clean against an environment. If the check command sees that cleanDisabled has been set to false, then it will temporarily auto-configure the build environment with the clean provisioner for the duration of the check command, if no provisioner has been set. The clean disabled parameter can be set in the toml as shown below:

[flyway]
cleanDisabled = false

Or can be passed as a CLI argument:

flyway check -changes "-check.buildEnvironment=shadow" -environment=prod -cleanDisabled=false



Didn't find what you were looking for?