Garrett Daniel DeMeyer
Garrett Daniel DeMeyer

Reputation: 931

Can I fix version numbers in Flyway without having migrations rerun?

We've had several migrations set up that were not versioned correctly. The filenames put the version in the description so the db was always at version 0. We want to rename them, but this will cause all of the scripts to rerun.

Currently, our files are named like V__001_The_First_Migration.sql.

We want to rename them to V001__The_First_Migration.sql without rerunning the migration.

Is there anyway to do this?

Upvotes: 2

Views: 1561

Answers (1)

Mehul Gayate
Mehul Gayate

Reputation: 344

I think in FlyWay configuration, there is one property which will help:

flyway.baselineVersion=1.0

Rename all the files or the files you want to rename and set the "baselineVersion" to the last run or latest script.

Here is more: https://flywaydb.org/documentation/commandline/baseline

https://flywaydb.org/documentation/maven/baseline

Let me know if you need more help or example.

Upvotes: 2

Related Questions