Run migrations on startup
This commit is contained in:
parent
950f023821
commit
5201e6e474
@ -2,14 +2,14 @@ using Api;
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
public class Program
|
var app = WebHost.CreateDefaultBuilder(args)
|
||||||
{
|
.UseUrls("http://0.0.0.0:5000")
|
||||||
private static void Main(string[] args)
|
.UseStartup<Startup>()
|
||||||
{
|
.Build();
|
||||||
CreateWebHostBuilder(args).Build().Run();
|
|
||||||
}
|
await using var scope = app.Services.CreateAsyncScope();
|
||||||
// Calls the startup class and creates the webinterface
|
await using var db = scope.ServiceProvider.GetService<DBContext>();
|
||||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
await db.Database.MigrateAsync();
|
||||||
WebHost.CreateDefaultBuilder(args)
|
|
||||||
.UseStartup<Startup>();
|
app.Run();
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user