The check
command is currently in beta. This feature will be available in future products, but during the beta phase you can access it through your Flyway Teams or Redgate Deploy license.
In Flyway, “Checks” is the collective term we use for the pre- or post-deployment analysis of some aspect of your database migration. Checks are instantiated using the top level check
command.
Before performing a deployment to the target database (most notably, production), you might want to look over what you’re about to do and understand one or more of the following:
Each of these scenarios can be met with the check
command, using the corresponding flag:
Scenario | Command & Flag | Output |
---|---|---|
In beta Will these changes have the effect I am expecting? |
check -changes | ChangeReport.html, ChangeReport.json |
In beta What database changes have been made recently? |
check -changes | ChangeReport.html, ChangeReport.json |
In beta Is the production database in the state I am expecting it to be in? |
check -drift | ChangeReport.html, ChangeReport.json |
Coming soon Are our changes following internal policies ? |
Check –changes
The –changes
flag produces a report indicating differences between applied migration scripts on your target database and pending migrations scripts (ie. the set of instructions you want to use to change your target database).
You can use this capability pre- and post-deployment:
In either scenario, using the -changes
flag will help you infer which database objects will be/have been affected - and how – when you execute/have executed your migration script(s).
The check –changes
command and flag works by building a temporary database. This temporary database is first made to reflect the state of your target schema, and then made to reflect your target schema with the pending changes applied.
The difference between the two states of this temporary database (target now, and target with changes applied) represents the effect your pending migrations will have (or have had) when the scripts are (or were) executed. This difference is captured as an artefact called a “Change Report”. The change report is available as both HTML (human readable) and JSON (machine readable) formats.
The process works like this:
flyway check –changes
Flyway’s check –changes
will then: