Check Code

This is available in Flyway CLI only

Flyway Community

Description

Check with the -code flag produces a report showing the results of running static code analysis over your SQL migrations.

One of the analysis engines is SQLFluff, is an external dependency and installation instructions are covered in Check Code Concept

Usage

./flyway check -code -environment=development

Typically you would have defined an environment for Flyway to work with. Flyway can also operate without a defined environment but then all migrations will be analysed. Otherwise only pending migrations will be analysed

If you want to explicitly specify filename of the generated report then the reportFilename parameter can be configured.

If you want to explicitly specify where Flyway should look for rules then the rulesLocation parameter can be configured. This would help if you have created a number of custom rules that exist outside of the Flyway installation and don't want to have to copy them back into Flyway when you update.

Analysis engine: Regular Expressions (Regex)

Flyway Enterprise

Customers can easily craft their own custom rules or take advantage of the set of rules Flyway provides:

Feature:Failing on Rule Violations

Flyway Teams

You can configure your pipeline to fail when specified conditions are met. This can be done by configuring the following parameters:

Example:

./flyway check -code -environment=development '-check.majorTolerance=3' '-check.majorRules=L034,L042'

This will fail if rules L034 and L042 are violated 4 or more times in total across all scanned migration scripts.

Notes

  • Flyway makes use of any configured locations to determine what migrations to analyse.

Didn't find what you were looking for?