8

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

Tom Lianza
  • 4,012
  • 4
  • 41
  • 50

2 Answers2

4

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.

Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
  • Thanks - I actually think out-of-order is safe so often that it's a great solution. If two people are editing the same parts of the schema at roughly the same time, the likelihood that their code is also going to cause a merge conflict is also high, so that would force an untangling. – Tom Lianza Oct 16 '12 at 01:42
  • 1
    Let's say my co-worker and I both create a V5-xxx migration. When I pull his changes in before committing I get a conflict. Then is it up to me to update my version to V6 after his? I guess like Tom Lianza said, this will enforce that there are no merge conflicts since if my database is in conflict after applying the changes, then our code is probably conflicting as well. Why not apply some sort of author scheme after the version number like liquibase so that renaming isn't necessary? – eipark Apr 03 '13 at 12:40
0

The best way that I have seen to overcome the versioning issues between branches to enable outOfOrder and use a timestamp as the version number

See my answer here: How to use Flyway when working with feature branches

Community
  • 1
  • 1
mad_fox
  • 3,030
  • 5
  • 31
  • 43