check produces reports to increase confidence in your migrations.
-drift, Flyway migrates against a build database and compares this against the target database in order to generate a report.
This build database will be cleaned before it is used, so you must ensure it does not contain anything of importance.
You can read more about the
check concept here.
sqlfluffis required for Code Analysis (
-code). You can install it by running
pip3 install sqlfluff==1.2.1or use the
redgate/flywayDocker image that has
|-changes||Contact us Include pending changes that will be applied to the database|
|-drift||Contact us Include changes applied out of process to the database|
|-code||In Preview Performs code analysis on your migrations|
|-dryrun||Flyway Teams Performs a dry run, showing what changes would be applied in a real deployment|
|check.buildUrl||URL for a build database.|
|check.buildUser||Username for the build database. Defaults to ‘flyway.user’|
|check.buildPassword||Password for the build database. Defaults to ‘flyway.password’|
|check.reportFilename||[REQUIRED] Destination filename for reports|
|check.nextSnapshot||A snapshot containing all migrations including those that are pending (generated via
|check.deployedSnapshot||A snapshot containing all applied migrations and thus matching what should be in the target (generated via
|check.appliedMigrations||A comma-separated list of migration ids (migration versions or repeatable descriptions) to apply to create snapshots (generated via
|check.majorRules||A comma-separated list of SQL Fluff rule codes that are considered to be ‘major’ issues|
|check.minorRules||A comma-separated list of SQL Fluff rule codes that are considered to be ‘minor’ issues|
|check.majorTolerance||The number of ‘major’ issues to be tolerated before throwing an error|
|check.minorTolerance||The number of ‘minor’ issues to be tolerated before throwing an error|
If this filename does not have the
.html suffix, Flyway will add it for you. Flyway also produces a
json result for programmatic consumption.
flyway check -changes -url=jdbc:example:database -user=username -password=password -check.buildUrl=jdbc:example:build_database
flyway.url=jdbc:example:database flyway.user=username flyway.password=password flyway.check.buildUrl=jdbc:example:build_database flyway.check.reportFilename=change_report
Change and drift reports work on the following databases:
Code analysis and Dry run reports work on any database supported by Flyway.
When using Check with an Oracle database there are additional requirements.
If no schemas are specified in the configuration
flyway.schemas, then the database connection username will be used as the default schema, otherwise
flyway.schemas will be used.
These schema names are case-sensitive.
If you see errors about being unable to connect to your database and you are specifying
localhost as the host, then this may be due to not having pipes configured. Using
127.0.0.1 instead should work.