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

ParameterNamespaceDescription
rulesLocationcheckWhere Flyway looks for rules.
rulesConfigcheckWhere to locate the SQLFluff configuration file.
rulesDialectcheckSpecifies the SQL dialect for analysis.
scopecheckSpecifies the scope of migration files to include in code analysis
regexEnabledcheckEnable or disable the Regex Engine for code analysis.
sqlfluffEnabledcheckEnable or disable the SQLFluff Engine for code analysis.
code.failOnErrorcheckWhether to fail based on the violation severity level.
generateReport
checkWhether to generate an HTML report.
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?