Check Drift
Published 14 March 2024
Check: Drift
This is available in Flyway CLI only
Description
This produces a report indicating differences between structure of your target database and structure created by the migrations applied by Flyway.
See also the Drift Report Concept page
Usage
Commandline
./flyway check -drift -environment=production -check.buildEnvironment=build
You need to specify the environments Flyway should use for conducting the drift report.
environment
- This would typically be your target/production environmentcheck.buildEnvironment
- This is where Flyway will populate the database based on the migrations that exist in your target environment.- Alternatively, if you do not have a build database you could use a snapshot via
check.deployedSnapshot
instead.
- Alternatively, if you do not have a build database you could use a snapshot via
If you want to explicitly specify the filename of the generated report then the reportFilename
parameter can be configured.
If you want Flyway to return a non-zero exit code in the event of drift being present then the failOnDrift
exists for configuring this. You could use this in a pipeline and you want to take action based on the presence of drift.
TOML Configuration File
Typically you would define the environments you want to work with in the TOML configuration file.
Alternatively you can configure some or all of the environments directly on the command line when calling Flyway.
Configuration File
Environments are not supported in .conf files so the build environment needs to be configured using the parameters:
For example:
flyway.check.buildUrl=jdbc:sqlserver://localhost:1433;databaseName=build;encrypt=false
flyway.check.buildUser=dbUser
flyway.check.buildPassword=password