Redgate Flyway

Check Code

Description

The check -code command runs static code analysis over your SQL migrations from filesystem: Locations.

See Code Analysis 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 analysis
regexEnabled check Enable or disable the Regex Engine for code analysis.
sqlfluffEnabled check Enable or disable the SQLFluff Engine for code analysis.
code.failOnError check Whether to fail based on the violation severity level.
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:

  • Static code analysis will not interrupt the execution of subsequent Flyway verb operations if they are chained. This means that even if failOnError is 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,
        "description" : "Ensure delete statements have a condition attached.",
        "code" : "RG06",
        "warning" : false,
        "help" : "https://help.red-gate.com/help/flyway-cli12/help_0.aspx?topic=rules/RG06"
      } ]
    } ]
  } ]
}

Error codes

This command can produce the following error codes:


Didn't find what you were looking for?