🐛 Ensure that migrations run
Co-authored-by: haraldnilsen <harald_998@hotmail.com>
This commit is contained in:
parent
187c669495
commit
f9b4309072
1 changed files with 2 additions and 5 deletions
|
@ -36,11 +36,8 @@ var services = builder.Services.BuildServiceProvider();
|
|||
using (var scope = services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<MovieDbContext>();
|
||||
|
||||
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())
|
||||
|
|
Reference in a new issue