diff --git a/barkmanAPI/Program.cs b/barkmanAPI/Program.cs index 5840703..35c5c5f 100644 --- a/barkmanAPI/Program.cs +++ b/barkmanAPI/Program.cs @@ -75,5 +75,12 @@ app.MapDelete("/inventory/{id}", async (int id, BarkContext db) => return Results.Ok(new { Message = "Inventory item deleted successfully" }); }); +app.Services.GetRequiredService().Database.Migrate(); -app.Run(); \ No newline at end of file +using (var serviceScope = app.Services.CreateScope()) +{ + var dbContext = serviceScope.ServiceProvider.GetRequiredService(); + dbContext.Database.Migrate(); +} + +app.Run();