Wrap ef core database update in a transaction

0

My recent database update failed in the middle of a migration, leaving the database inconsistent:

> dotnet ef database update 
Applying migration '20200429031727_NewRequisitesAndCountry'.
Failed executing DbCommand (97ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
[...]
Microsoft.Data.SqlClient.SqlException (0x80131904): Subquery returned more than 1 value. This is not 
permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

Is there a way to wrap the migration in a transaction? I am interested in doing so both from the command line and programmatically while calling context.Database.Migrate().

ef-migrations
ef-core-3.1
asked on Stack Overflow May 14, 2020 by Sergey Slepov • edited May 14, 2020 by Sergey Slepov

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0