Reasons why Flyway may fail

Database changes executed by Flyway are designed to be safe. In the database world this means that if the tool believes that the data should be in a certain state and it is not, the tool will stop rather than taking a risk of causing data corruption. Many of the queries executed by Flyway are not reversible as they may involve data migration or deletion, as such it is very important for the tool to be conservative and to prefer failing to continuing.

The following is an incomplete list of reasons that may cause Flyway to fail:

  1. Data being updated has been changed from what it should be from a vanilla installation. Mostly applies to configuration data.
  2. A record being inserted is conflicting with previously inserted record with the same primary key.
  3. For large scale migrations (on big schema changes) the data being migrated does not appear to fit the structure the application expects the data to be in. Mostly affects transactional data.