Check Code
Published 15 January 2025
Description
The check -code command performs a code review on your SQL migrations from filesystem: Locations.
See Code Review for more information.
Usage examples
flyway check -code
Parameters
Optional
| Parameter | Namespace | Description |
|---|---|---|
rulesLocation |
check | Where Flyway looks for rules. |
rulesConfig |
check | Where to locate the SQLFluff configuration file. |
rulesDialect |
check | Specifies the SQL dialect for analysis. |
scope |
check | Specifies the scope of migration files to include in code review |
regexEnabled |
check | Enable or disable the Regex Engine for code review. |
sqlfluffEnabled |
check | Enable or disable the SQLFluff Engine for code review. |
code.failOnError |
check | Whether to fail based on the violation severity level. |
code.noqaSeverity |
check | Severity of the warning if noqa is used to disable a SQLFluff rule. |
reportFilename |
(root) | The output path of the generated report. |
workingDirectory |
(root) | The directory to consider the current working directory. All relative paths will be considered relative to this. |
| {environment parameters} | (root) | Environment configuration for the source and/or target environments. |
Universal commandline parameters are listed here.
Note:
- Code review will not interrupt the execution of subsequent Flyway verb operations if they are chained. This means that even if
failOnErroris enabled, Flyway will continue processing the remaining verb operations. For this reason, it is recommended to run subsequent Flyway verbs separately.
JSON output format
{
"individualResults" : [ {
"timestamp" : "2026-02-03T15:35:14.170951075",
"operation" : "code",
"exception" : null,
"licenseFailed" : false,
"results" : [ {
"filepath" : "/projects/flyway/sql/V1__no_where.sql",
"violations" : [ {
"line_no" : 1,
"line_pos" : 1,
"line_no_end" : 1,
"line_pos_end" : 18,
"file_pos" : 0,
"file_pos_end" : 17,
"description" : "Ensure delete statements have a condition attached.",
"code" : "RG06",
"warning" : false,
"engine" : "SQLFluff",
"help" : "https://help.red-gate.com/help/flyway-cli12/help_0.aspx?topic=rules/RG06",
"fixes" : null
} ]
} ]
} ]
}
Suggested fix instructions may optionally be provided as an array on the fixes property of the JSON output for some issues. Individual fix instruction may take one of the following formats:
{ "type": "delete", "file_pos": 0, "file_pos_end": 0 }
{ "type": "replace", "file_pos": 0, "file_pos_end": 0, "content": "updated text" }
{ "type": "insert", "file_pos": 0, "content": "inserted text" }
Error codes
This command can produce the following error codes: