Redgate Summit – The Database DevOps Transformation Watch now
PASS Data Community Summit logo

PASS Data Community Summit

A hybrid conference in Seattle and online

15-18 November

Flyway Documentation

This documentation is deprecated. The new documentation can now be found on documentation.red-gate.com

Poll

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:

  • D to force a debug message
  • D- to force a debug message, but do not show the original sql state and error code
  • D+ to force a debug message, but only 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
  • I+ to force an info message, but only 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
  • W+ to force a warning, but only 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
  • E+ to force an error, but only 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

Example 4: Use this errorOverride to raise an error for any error or warning, showing only the SQL state and error code without the rest of the message (this is useful for cases where the full error message contains a large SQL statement which would take up the entire commandline output): \*:\*:E+

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>

Use Cases

See our error overrides examples.