Get the most out of Flyway v7 - Sign up for our webinar on the Redgate Hub ▶ Watch now

Error Overrides

Flyway Teams

Description

Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force specific errors or warnings to be treated as debug messages, info messages, warnings or errors.

Each error override has the following format: STATE:12345:W. It is a 5 character SQL state (or * to match all SQL states), a colon, the SQL error code (or * to match all SQL error codes), a colon and finally the desired behavior that should override the initial one.

The following behaviors are accepted:</p>

  • D to force a debug message
  • D- to force a debug message, but do not show the original sql state and error code
  • I to force an info message
  • I- to force an info message, but do not show the original sql state and error code
  • W to force a warning
  • W- to force a warning, but do not show the original sql state and error code
  • E to force an error
  • E- to force an error, but do not show the original sql state and error code

Example 1: to force Oracle stored procedure compilation issues to produce errors instead of warnings, the following errorOverride can be used: 99999:17110:E

Example 2: to force SQL Server PRINT messages to be displayed as info messages (without SQL state and error code details) instead of warnings, the following errorOverride can be used: S0001:0:I-

Example 3: to force all errors with SQL error code 123 to be treated as warnings instead, the following errorOverride can be used: *:123:W

See errorOverrides for more details.

Usage

Commandline

./flyway -errorOverrides="STATE:12345:W" clean

Configuration File

flyway.errorOverrides=STATE:12345:W

Environment Variable

FLYWAY_ERROR_OVERRIDES=STATE:12345:W

API

Flyway.configure()
    .errorOverrides("STATE:12345:W")
    .load()

Gradle

flyway {
    errorOverrides = 'STATE:12345:W'
}

Maven

<configuration>
    <errorOverrides>STATE:12345:W</errorOverrides>
</configuration>