fix: make development database seeding reliable
This commit is contained in:
@@ -8,6 +8,7 @@ using Tiku.Infrastructure;
|
||||
using Tiku.Infrastructure.Persistence;
|
||||
using Tiku.Infrastructure.Bootstrap;
|
||||
using Tiku.Application;
|
||||
using Tiku.Application.Security;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
builder.Logging.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Warning);
|
||||
@@ -47,6 +48,8 @@ builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider();
|
||||
|
||||
using var host = builder.Build();
|
||||
await using var scope = host.Services.CreateAsyncScope();
|
||||
scope.ServiceProvider.GetRequiredService<ITenantContextInitializer>()
|
||||
.InitializeSystem(null, "Database migration and bootstrap");
|
||||
var dbContext = scope.ServiceProvider.GetRequiredService<TikuDbContext>();
|
||||
await dbContext.Database.MigrateAsync();
|
||||
var catalogSeeder = ActivatorUtilities.CreateInstance<BuiltinBackofficeCatalogSeeder>(scope.ServiceProvider);
|
||||
|
||||
Reference in New Issue
Block a user