Migrations hang on permissions scripts since v1.7.0
Describe the bug
Ever since v1.7.0 permissions scripts will just hang if a view script exists and when running with --trx on SQL Server. It doesn't even have to run it in the same migration. It's enough that the view script exists and has previously been run.
I originally reported this as #508 but then I couldn't correctly pinpoint the issue and we ended up on the wrong track.
To Reproduce
- Install 1.7.0 or 1.8.0 with dotnet tool:
dotnet tool update -g grate --allow-downgrade --version 1.8.0. - Create
views\01.sql - Create
permissions\Create.sql - Run
grate --connectionstring "Server=localhost,1433;Database=***;TrustServerCertificate=True;User Id=sa;Password=***" --files . --trx - Observe that grate hangs on
Running 'Create.sql'.
Example scripts:
views\01.sql:
CREATE VIEW [myview] AS
SELECT 1 as [Number]
permissions\Create.sql:
DROP USER IF EXISTS [myuser];
CREATE USER [myuser] WITHOUT LOGIN
You can also leave out the Create.sql, run migrations, then add the Create.sql and try to run migrations. The view has been created but Create.sql will hang.
Expected behavior Create.sql completes and the user is created in the db.
Desktop (please complete the following information):
- OS: Windows
- Version: 1.7.0 or 1.8.0
- Installed with
dotnet tool