I have a Flyway migration that is failing in Flyway Community Edition 6.0.8 with the following error:
The procedure 'sys.sp_grantdbaccess' cannot be executed within a transaction.
My original migration script is:
EXEC sp_grantdbaccess 'foo', 'bar'
I attempted to run it as dynamic SQL but ran into the same issue:
exec('EXEC sp_grantdbaccess N''foo'', N''bar''')
I have also tried the -mixed=true option on the flyway migrate command line to allow transactional and non-trnsactional migrations to run but I am receiving the same error.
Can transactions be disabled on a per-migration basis? Or even for an entire "migrate" operation? If neither of those are options, is there a way within the migration script itself to effect the change in question without running into the transaction restriction?
This is not a duplicate of Is there any way to disable flyway SQL migration from the transaction for several reasons:
The ability to configure individual scripts to (not) run in a transaction has been added in Flyway 6.1: https://documentation.red-gate.com/flyway/reference/script-configuration