I just encountered the following situtation:
The test-server is currently running Flyway, with version 1 (V1
). The test-server is automatically updated (including Flyway scripts) whenever anything is pushed on the develop
branch.
A developer decides to start working on a new feature on branch feature/123
. This developer creates a database script (Flyway compatible) called V2__cool_feature.sql
. In the meantime, another developer also starts working on a feature branch called feature/456
. This developer is also in need of an update script, and names it V3__another_cool_feature.sql
, because the developer knows that V2
is already used on another branch. This feature/456
branch is finished and is merged, and so the current scripts on the develop branch are V1
& V3
. This works well and the V3 script is executed, leaving Flyway its schema_version
on version 3.
The other feature branch feature/123
is also merged, which means that the develop branch contains the scripts V1
, V2
& V3
.
Now this is were I'm having trouble with Flyway:
The build, including Flyway, is executed and it leaves the following message:
[INFO] Database: jdbc:mysql://example.com:3306/my_schema (MySQL 5.5)
[INFO] Successfully validated 2 migrations (execution time 00:00.019s)
[INFO] Current version of schema `my_schema`: 3
[INFO] Schema `my_schema` is up to date. No migration necessary.
What I want to happen is that the V2 script is executed, and I'm not sure how to do so.
I hope I explained my problem well, if not, please leave a comment.
Ugh, I'm not a smart guy. Putting a bit more effort into my Googling skills lands me upon the Flyway documentation, describing exactly my problem:
Option: outOfOrder
Required: NO
Default: false
Description: Allows migrations to be run "out of order". If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored. (Even the same versioning as in my question is used >.< )