Hi Flyway team.
We have a jenkins script to deploy DDL changes to Postgres. 
On each build execution, it executes following flyway commands 

info
repair
migrate

I have been trying to convince my team that repair is the tool to be used only when there is an exceptional scenario. It should be NOT be run all the time. It can cause problems.
One problem is if a developer changes already applied migration, repair will fix the checksum and flyway migrate will succeed. Developer will think change is applied, but actually it isn't. Without repair, migrate would have failed, which is correct. 

Please provide guidelines on when to use repair and what are the repercussions of using it all the time.
virajb
0

Comments

6 comments

  • Peter_Laws
    Hello virajb,

    Thank you for the question. Your understanding is indeed correct, it should be invoked as needed, not as a matter of course. There are multiple reasons for this.

    As you highlighted, the safety net of checksum changes, in the current configuration, someone could essentially make silent modifications and were this then later run against a new environment, you would have disparate results.

    Showing failed migrations is particularly desirable if you have multiple people contributing as it will highlight existing issues, making it easier to avoid compounding them.

    Lastly, something often missed is that repair is a targetted command just like migrate. So if the locations were to change in your pipeline for migrate alone, the unmodified repair command would then most likely not do what you were intending and on the next run, remove all the applied migration that it couldn't resolve.
    (source)

    The intention of repair should effectively be 'maintenance mode' in the event manual intervention is required.
    Peter_Laws
    0
  • virajb
    Thanks for clarification Peter !
    virajb
    0
  • Peter_Laws
    My pleasure virajb, if our answers are helpful please consider marking them as an accepted answer, to help others members of the community find useful information.

    Have a good week.
    Peter_Laws
    0
  • virajb
    I can't find a way to mark it as accepted.
    virajb
    0
  • virajb
    It shouldn't be that hard to find it. Can't find anything apart from agree and like buttons. 
    Screenshot



    virajb
    0
  • Peter_Laws
    I've just noticed your post was marked as a discussion rather than a question, I've just altered it.
    Do you now have the option to mark it as answered? You may need to refresh.
    Peter_Laws
    0

Add comment

Please sign in to leave a comment.