-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
efcore9: Migration with .Sql that suppresses a transaction logs an error even though it works #35133
Comments
Similar to #35096. |
This is by design. As the message says you should create a separate migration that contains just the operation that suppressed transactions. |
@AndriySvyryd Why would an operation that does not fail not log a warning instead of an error, the what-is-new documentation explicitly mentions that only a warning will be given? And what is the proposed solution to remedy that in old migrations? |
Perhaps you have the default behavior for warnings set to .ConfigureWarnings(e => e.Log(RelationalEventId.NonTransactionalMigrationOperationWarning)); |
@AndriySvyryd Maybe there is some confusion here. The issue I have is with that log being of the log-level "Error" instead of the (imho) more appropriate level "Warning" (since everything works just fine and the event id is even called 'NonTransactionalMigrationOperationWarning'). |
To be more precise, this is about the log level defined here:
|
I see. Yes, we can change that. |
When switching to efcore9 existing migrations that include a
.Sql(..., suppressTransaction: true)
will generate an error in the log even though they work.The what is new documentation states this should only issues a warning.
Include your code
I uploaded a minimal reproduction here.
Include verbose output
The log outputs the fail message but also shows that the SQL is executed correctly.
Include provider and version information
EF Core version: no error log on 8, but error logged on 9
Database provider: tested with SQL and SQLite
Target framework: .NET8 and .NET9
The text was updated successfully, but these errors were encountered: