0

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 Answers1

0

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.

Grant Fritchey
  • 2,645
  • 19
  • 21
  • Thank you for the reply, Grant! But, in fact my migration it's correct, I just wrote wrong here, and forgot to put the "__" Now I fixed it in the post. Sorry. And by the way, it still doesn't work and I will read your article. – Roberson Mendes Sep 14 '22 at 14:38
  • Grant, I was reading your article and [this article](https://flywaydb.org/blog/flyway-timestampsandrepeatables) and then I realize that maybe it has no option to put the timestamp as the name without de default prefixes. Is it right? – Roberson Mendes Sep 14 '22 at 15:17
  • I fix my problem, but just can fix in enabling flyway in the config application files. If I try to run the task via terminal command, I still can't do it. – Roberson Mendes Sep 14 '22 at 19:40
  • Oh, crud. I missed that you didn't have 'V' in front. Yeah, that's required too. Silly me. Sorry for that. – Grant Fritchey Sep 15 '22 at 12:50