Options

Flyway migration not showing failed migration for Postgres

santanasantana Posts: 2 New member
edited February 23, 2023 3:59PM in Flyway (General Discussion)
Im running flyway scripts to postgress database, i have one failed migration, but this failed migration is not showing up on flyway table. Im able to see successful migration, but not failed.

Any ideas why?
Tagged:

Answers

  • Options
    Hello santana

    Great question, thank you. This is almost certainly due to your migration being handled in a transaction and due the failure automatically being rolled back. This functionality in flyway is db dependant, SQL Server and Postgres do it automatically. 

    I've mocked up a quick example here, including a info call afterwards so you can see how flyway views the migration status after the event.



    Were it either on a db incapable of rolling back, or for some other reason be unable to roll back, instead of showing as pending due to effectively never happening, it would have a status of failed.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • Options
    santanasantana Posts: 2 New member
    Thanks for taking time. Yes, this is the desired behavior. But my question is more related to flyway table. Failed migration recorded on flyway table its not bean shown. I should have state  as not successfull save on record on failed migration. But im not having this.
  • Options
    This is due to the rollback, as the change was undone. Whereas a failure migration implies that the db needs some corrective action, which is not the case.

    I appreciate this might not align with your expectations, it's a nuance in the different between success / failure of the tool running and success / failure of the code being deployed.

    Essentially you're looking for some proof that your intervention is required, which presently doesn't exist, or a historical record of events?
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file