After fail of EnsureCreatedAsync method database will be in inconsistent state. Why we are not using transaction? #3908
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Hello,
I'm not sure that it's a bug, but at least some unexpected behavior.
In our code we are using something like that.
using (var db = serviceProvider.GetService())
{
var databaseCreated = await db.Database.EnsureCreatedAsync();
}
as a result of this call we catch an exception with text "{"Introducing FOREIGN KEY constraint 'FK_Ride_Driver_DriverId' on table 'Ride' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.\r\nCould not create constraint or index. See previous errors."}"
I would expect that database as a result will be empty, but in fact it was partially creates.
The text was updated successfully, but these errors were encountered: