Clean error alerts and harden startup migration
This commit is contained in:
@@ -870,7 +870,17 @@ public static class StartupInitializationExtensions
|
||||
}
|
||||
}
|
||||
|
||||
db.Database.Migrate();
|
||||
try
|
||||
{
|
||||
using var migrationScope = app.Services.CreateScope();
|
||||
var migrationDb = migrationScope.ServiceProvider.GetRequiredService<JobTrackerContext>();
|
||||
migrationDb.Database.Migrate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
app.Logger.LogError(ex, "Database migration failed during startup initialization.");
|
||||
throw;
|
||||
}
|
||||
|
||||
// Optional: seed an initial admin user for local username/password login.
|
||||
// Set Auth:AdminEmail and Auth:AdminPassword to enable.
|
||||
|
||||
Reference in New Issue
Block a user