Search code examples
sql-serverflyway

Is there any way to disable flyway SQL migration from the transaction


I'm trying to execute the Flyway migration to drop fulltext index but it could not be run inside the migration:

DROP FULLTEXT INDEX ON BusinessEntity

It throws an error:

Message: DROP FULLTEXT INDEX statement cannot be used inside a user transaction.

As I understand from the documentation:

Flyway runs each migration in a separate transaction.

I am interesting is there any way to run SQL code outside the migration or somehow turn it off for certain?


Solution

  • This problem has already been fixed in the Flyway master branch but is not yet in a release.

    The next version, 5.2.0, should resolve it.

    In the meantime, you could build it from source yourself.

    Update 2019-01-03

    Version 5.2.0 was released a while back.

    I have created a repository to replicate the error using Flyway 5.1.4 - or at least it fails on CREATE FULLTEXT INDEX because of the same underlying problem. Changing the version to 5.2.0 fixes the problem, as expected.