문제

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.

도움이 되었습니까?

해결책

No. It is always locked. This is part of the mechanics to prevent multiple competing nodes from migrating the DB in parallel.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top