15

We are having many projects running on many servers looking up into one database, and we"re thinking to setup Flyway to every project for control our database structure.

But we are worrying about concurrent migration problem, if some projects re-deploy in sametime. (Of course, we always take care the "If exist" things in SQL syntax.)

How does Flyway work when concurrent changes are made on same data table or other structural thing?

1 Answer 1

16

It works as expected. See the answer in the FAQ: https://documentation.red-gate.com/flyway/flyway-cli-and-api/learn-more/frequently-asked-questions#parallel

Can multiple nodes migrate in parallel?

Yes! Flyway uses the locking technology of your database to coordinate multiple nodes. This ensures that even if multiple instances of your application attempt to migrate the database at the same time, it still works. Cluster configurations are fully supported.

1
  • Though it's not very clear what specifically do they mean by "locking technology of your database" =/. I would expect that they do something like insert a record in flyway_schema_history on start with success=false and use this insert for optimistic locking, though that's just a guess.
    – Klesun
    Commented Oct 1, 2021 at 19:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.