From a5fad989713caa10e2cb5536ca9976a3a56cc1fb Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 8 Dec 2025 22:42:07 +0100 Subject: [PATCH] Fixes .gitignore and added Auto Migration --- .gitignore | 2 +- CouchLog/CouchLog.csproj | 48 ++++++++++++++++++++++++++++++++++++++++ CouchLog/Program.cs | 5 +++-- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f18d73d..9bc865f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .vs bin Debug -/WatchLog/Data/WatchLog.db +/CouchLog/Data/CouchLog.db #Migrations obj diff --git a/CouchLog/CouchLog.csproj b/CouchLog/CouchLog.csproj index b7c7edc..4b41fba 100644 --- a/CouchLog/CouchLog.csproj +++ b/CouchLog/CouchLog.csproj @@ -9,6 +9,54 @@ True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CouchLog/Program.cs b/CouchLog/Program.cs index 102fd78..1edd7a6 100644 --- a/CouchLog/Program.cs +++ b/CouchLog/Program.cs @@ -61,6 +61,9 @@ app.MapAdditionalIdentityEndpoints(); using (var scope = app.Services.CreateScope()) { + var CouchLogDB = scope.ServiceProvider.GetRequiredService(); + CouchLogDB.Database.Migrate(); + var roleManager = scope.ServiceProvider.GetRequiredService>(); var userManager = scope.ServiceProvider.GetRequiredService>(); @@ -120,8 +123,6 @@ using (var scope = app.Services.CreateScope()) await userManager.AddToRoleAsync(adminUser, "Admin"); } - var CouchLogDB = scope.ServiceProvider.GetRequiredService(); - MediaType mediaType = new() { Name = "Movie"