dotnet-ef migrations script
omits required GO
separators in EF Core 9, causing SQL batch errors
#35731
Labels
dotnet-ef migrations script
omits required GO
separators in EF Core 9, causing SQL batch errors
#35731
Bug description
We effectively do stored procedure migrations like:
Running
dotnet-ef migrations script
version 8.0.8 results in the following script:However, running the same command on version 9.0.2 results in the following script:
Which is invalid due to the error
[S0001][111] 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
We can work around the issue for now using
migrationBuilder.Sql(sql, suppressTransaction: true)
, but that is not ideal.This regression does not impact migration bundles—only the
dotnet-ef migrations script
tool appears to be affected.Your code
EF Core version
9.0.2
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET 9
Operating system
Windows 11
The text was updated successfully, but these errors were encountered: