Reputation: 679
I've renamed some previously created migration files and would like to update Flyway's schema_version table to contain the new names for migrations which have already been applied.
I attempted to create a migration that simply updates the affected rows in the schema_version table, but running this migration causes the migration process to hang since the schema_version table is locked.
Is there a way to update data in the schema_version table using a migration?
I'm using MySQL.
Upvotes: 0
Views: 3322
Reputation: 1639
You can place the required SQL in a beforeValidate.sql
file:
UPDATE schema_version
SET script = 'new_name'
WHERE script = 'old_name'
There's one caveat: the above fails when schema_version
table doesn't exist yet on a clean environment. This can be solved by using Java FlywayCallbacks where you have more control over error handling.
Upvotes: 1
Reputation: 35169
No. It is always locked. This is part of the mechanics to prevent multiple competing nodes from migrating the DB in parallel.
Upvotes: 1