mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[deps] DbOps: Update EntityFrameworkCore to v8 (major) (#3744)
* [deps] DbOps: Update EntityFrameworkCore to v8 * Only Run EnsureDeleted If Factory Owns Connection This only worked because of a bug in dotnet/efcore#33930 that was fixed in 8.0. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
This commit is contained in:
@ -208,13 +208,16 @@ public abstract class WebApplicationFactoryBase<T> : WebApplicationFactory<T>
|
||||
}
|
||||
}
|
||||
|
||||
private static void MigrateDbContext<TContext>(IServiceCollection serviceCollection) where TContext : DbContext
|
||||
private void MigrateDbContext<TContext>(IServiceCollection serviceCollection) where TContext : DbContext
|
||||
{
|
||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var services = scope.ServiceProvider;
|
||||
var context = services.GetService<TContext>();
|
||||
context.Database.EnsureDeleted();
|
||||
if (_handleSqliteDisposal)
|
||||
{
|
||||
context.Database.EnsureDeleted();
|
||||
}
|
||||
context.Database.EnsureCreated();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user