Flyway doesn't find migrations prefixed with timestamp

Viewed 27

I am using Kotlin with spring and, FlywayPlugin 9.3 and Flyway-core without specifying the version to run the migrations.

The configuration file is like this:

flyway {
    url = "url"
    user = "user"
    password = "password"
    locations = arrayOf("filesystem:src/main/resources/db/migration/common")
    placeholderPrefix = "\${flyway:timestamp}"
    sqlMigrationPrefix = "\${flyway:timestamp}"
}

and in db/migration/common I have migrations with the follow format: 202203311000__create-something-table.sql

But when I execute flyway migration command, it doesn't recognize the migrations and I get the following messages: Unrecognised migration name format: 202203311000__create-le-table.sql

However, if I change the prefixes of the files (to V1, V2...) it normally recognizes the migrations.

edit1: I wrote migration's name wrong (I didn't just copy and paste

edit2: Put one of the outputs of flyway validateMigrationName

1 Answers

You have this: 202201311000_create-something

When you need this: V202201311000__create-something

The only differences are the addition of the 'V' to tell Flyway this is a migration script and the two underscores after the number. Those are both part of the naming standard. Assuming that timestamp is always sequential (and it should be, obviously), that ought to fix the issue.

Here's an article I wrote on this. I mess this up frequently.

Related