Set flyway.validateOnMigrate
to true
and you should be good to go.
题
Here's my workflow:
Setup tables, constraints etc. in V1__CreateSchema.sql (checksum =
c3a82bcf43b3c78a5ca4ebd25ca06005)
Run flyway migration --> database gets created.
Then I realize that the schema needs to be updated:
Update sql statements in V1__CreateSchema.sql (checksum =
7e1aeb51d4e91b504cd920ec7af17092)
Run flyway migration --> flyway ignores the fact that a previously run migration's signature has changed.
[INFO] --- flyway-maven-plugin:2.3:migrate (default-cli) @ zeus --- [INFO] Current version of schema `mydb`: 1 [INFO] Schema `mydb` is up to date. No migration necessary.
Is this a supported workflow? I would expect flyway to fail stating that a fork has been made in the past migration path.
解决方案
其他提示
As per the question, It looks like you are using flyway-maven-plugin
. Flyway maven plugin is supporting basic commands which could be used with flyway execution.
Here is the list of commands which are applicable to run with plugin.
1. Migrate
2. Validate
3. Info
4. Clean
5. Baseline
6. Repair
Example: mvn flyway:command_name
Now, let's say if we would like to confirm that current classpath schemas are changed or not from the previous versions then we could validate it by executing below command
mvn flyway:validate
Apart from this, Configure or add the property named with validateOnMigrate
to true
at your flyway properties.