I just set up and fully understand the span, and I came to this situation:
- I successfully set up a new project to work with span.
- I successfully migrated the test database from version 0 to 1.0.3.
- Failed to migrate to version 1.0.4. (I tried to add a column that was already there, no problem so far, my bad.)
However, as soon as I made the necessary changes to the corresponding script to work, flyway continued to display this message:
Current schema version: 1.0.4 com.googlecode.flyway.core.migration.MigrationException: Migration to version 1.0.4 failed! Please restore backups and roll back database and code!
Since I did not want to restore the full dump and apply each migration again, just to make the alter script table work, what I finally did was some changes to the schema_version table:
- 1 I deleted the entry for version 1.0.4
- 2nd I set the current_version field to 1 for version 1.0.3
- And then do the span: migrate again.
After that, the migration was finally applied and a success message was shown, however, I am not quite sure if this applies correctly to such situations. I am not sure if I have the right to modify the "schema_version" table myself, as I think this should only be changed by span.
So, explaining what happened to me, my question is:
Is there a way to "repeat" to apply failed migration in the span without changing the schema_version table itself?
Any command I don't know to complete this task?
pablocmg
source share