From 37d4dce0360b6f6246aa05401048a2f41265a08b Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Dec 2025 21:28:11 +0100 Subject: [PATCH] Added Auto Migrations to startup --- CouchLog/Program.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CouchLog/Program.cs b/CouchLog/Program.cs index 102fd78..83d7714 100644 --- a/CouchLog/Program.cs +++ b/CouchLog/Program.cs @@ -64,6 +64,10 @@ using (var scope = app.Services.CreateScope()) var roleManager = scope.ServiceProvider.GetRequiredService>(); var userManager = scope.ServiceProvider.GetRequiredService>(); + var CouchLogDB = scope.ServiceProvider.GetRequiredService(); + + 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(); - MediaType mediaType = new() { Name = "Movie"