admin fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@@ -141,11 +142,26 @@ app.MapRazorPages();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
// ── Apply pending migrations ───────────────────────────────────────────────
|
||||
await MigrateAllAsync(app);
|
||||
|
||||
// ── Seed roles and initial SuperAdmin ─────────────────────────────────────
|
||||
await SeedAsync(app);
|
||||
|
||||
app.Run();
|
||||
|
||||
static async Task MigrateAllAsync(WebApplication app)
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
var sp = scope.ServiceProvider;
|
||||
await sp.GetRequiredService<SorIdentityDbContext>().Database.MigrateAsync();
|
||||
await sp.GetRequiredService<CatalogDbContext>().Database.MigrateAsync();
|
||||
await sp.GetRequiredService<CollectionDbContext>().Database.MigrateAsync();
|
||||
await sp.GetRequiredService<BazaarDbContext>().Database.MigrateAsync();
|
||||
await sp.GetRequiredService<ChatDbContext>().Database.MigrateAsync();
|
||||
await sp.GetRequiredService<GameDbContext>().Database.MigrateAsync();
|
||||
}
|
||||
|
||||
static async Task SeedAsync(WebApplication app)
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
|
||||
Reference in New Issue
Block a user