Redgate Flyway

Repair

Description

Repairs the schema history table.

This will perform the following actions:

  • Remove any failed migrations
    (User objects left behind must still be cleaned up manually)
  • Realign the checksums, descriptions and types of the applied migrations with the ones of the available migrations
  • Mark all missing migrations as deleted
    • As a result, repair must be given the same locations as migrate!

For more information, see Flyway Schema History Table.

Usage examples

Repair via command line

flyway repair

Repair via Maven

mvn flyway:repair

Repair via Gradle

gradle flywayRepair

Parameters

Universal commandline parameters are listed here.

All relevant configuration settings are listed here. The settings from these sections can be set as parameters on the repair command:

  • General settings
  • Flyway schema history settings
  • Validation settings
  • Settings in database-specific namespaces
  • Settings in secrets management namespaces

It is also possible to set environment settings as parameters.

All parameters are optional, although a target environment must be configured or passed in.

JSON output format

{
  "repairActions": [
    "ALIGNED APPLIED MIGRATION CHECKSUMS"
  ],
  "migrationsRemoved": [],
  "migrationsDeleted": [],
  "migrationsAligned": [
    {
      "version": "1",
      "description": "first",
      "filepath": "C:\\flyway\\sql\\V1__first.sql"
    }
  ],
  "flywayVersion": "11.4.0",
  "database": "testdb",
  "warnings": [],
  "operation": "repair"
}

Error codes

This command can produce the following error codes:


Didn't find what you were looking for?