Sushan Ghimire
Sushan Ghimire

Reputation: 7567

Flyway customizing 'version' in naming convention

I'm using Flyway 3.2.1. Current properties are set to:

flyway.sqlMigrationPrefix=V
flyway.sqlMigrationSuffix=.sql
flyway.initVersion=0000
flyway.outOfOrder=false

According to the documentation, version can be:

Dots or underscores separate the parts, you can use as many parts as you like

enter image description here

Therefore I came up with this V_201509071234_Filename.sql, even according to examples, my name above should be valid. However when attempting to execute, it complains:

Flyway Error: org.flywaydb.core.api.FlywayException: Invalid version containing non-numeric characters. Only 0..9 and . are allowed. Invalid version: .201509071234

However, if I were to add a number before first underscore, like so, V2_201509071234_Filename.sql, it works.

How can I force Flyway to accept V_201509071234_Filename.sql as a valid name?

Upvotes: 6

Views: 14474

Answers (2)

Orlando Colamatteo
Orlando Colamatteo

Reputation: 177

This name would conform to the flyway convention: V201509071234_Filename.sql (no underscore in between V and the version number).

Upvotes: 0

Axel Fontaine
Axel Fontaine

Reputation: 35169

Set the prefix the be V_ and the separator to be _ and it should be OK (I hope)

Upvotes: 6

Related Questions