From f9b430907258c7da17d94e13aedbd5d7089c47a7 Mon Sep 17 00:00:00 2001 From: Sindre Kjelsrud Date: Tue, 3 Oct 2023 10:56:14 +0200 Subject: [PATCH] :bug: Ensure that migrations run Co-authored-by: haraldnilsen --- backend/cinemateket/Program.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backend/cinemateket/Program.cs b/backend/cinemateket/Program.cs index 85a4a6b..841b818 100644 --- a/backend/cinemateket/Program.cs +++ b/backend/cinemateket/Program.cs @@ -36,11 +36,8 @@ var services = builder.Services.BuildServiceProvider(); using (var scope = services.CreateScope()) { var context = scope.ServiceProvider.GetRequiredService(); - - if (context.Database.EnsureCreated()) - { - context.Database.Migrate(); - } + context.Database.EnsureDeleted(); // cursed + context.Database.Migrate(); // Check if movies are already inserted to avoid duplicate insertion if (!context.Movies.Any())