Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway - support for simultaneous versions / multiple branches

Does anyone know a good way to allow larger projects, with lots of engineers working in parallel, to handle versioning with Flyway? We often find that during merges to master, we wind up with conflicting merges just because 2-3 independent projects needed db changes, and they used the same version number.

In this scenario, I'm not even sure if a Rails-style timestamp for versioning would work, because you don't necessarily know the order in which the merges will be made to master.

Any good tricks to get around this, aside from having to re-number your migration just before merge?

Tom

like image 620
Tom Lianza Avatar asked Oct 03 '12 18:10

Tom Lianza


People also ask

Which is better Flyway or Liquibase?

While both tools are based on Martin Fowler's Evolutionary Database, there are many differences in what these tools offer. Here's where Liquibase and Flyway differ. The bottom line is that Liquibase is more powerful and flexible — covering more database change and deployment use cases than Flyway.

Is Flyway a transactional?

Flyway applies SQL migration scripts within a transaction, whenever possible, and will roll back the whole migration if it receives an error message on its connection to the database.

What does Flyway baseline do?

In Flyway, a baseline is simply an entry in the history table, with a version that tells Flyway the point from which to start all subsequent migrations. The baselining process doesn't create any scripts or other files in the Scripts directory.

Does Flyway lock table?

Flyway doesn't lock the schema. It then acquires a lock on the metadata table using SELECT * FROM metadatatable FOR UPDATE . This lock is released automatically after the migration completes when the transaction is commited or rolled back.


1 Answers

Renumbering certainly is one way.

Another simple technique for avoiding version number conflicts, is to have a whiteboard or a simply wiki page, where each developer can reserve a version number when they start working on it.

Alternatively, Flyway 1.8 will be out soon and it will include a feature that optionally allows migrations to be run out of order. This is however not risk-free in all scenarios.

like image 74
Axel Fontaine Avatar answered Oct 04 '22 08:10

Axel Fontaine