Added Auto Migrations to startup

This commit is contained in:
2025-12-08 21:28:11 +01:00
parent c2eed93e7c
commit 37d4dce036

View File

@@ -64,6 +64,10 @@ using (var scope = app.Services.CreateScope())
var roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
var CouchLogDB = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
CouchLogDB.Database.Migrate();
string[] roleNames = { "Admin", "User" };
IdentityResult roleResult;
@@ -120,8 +124,6 @@ using (var scope = app.Services.CreateScope())
await userManager.AddToRoleAsync(adminUser, "Admin");
}
var CouchLogDB = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
MediaType mediaType = new()
{
Name = "Movie"