mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
feat: added auto migration to API startup
This commit is contained in:
parent
731ccbf057
commit
560be3ce13
@ -9,6 +9,7 @@ using Auth0.AspNetCore.Authentication;
|
||||
using comissions.app.database;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
@ -144,7 +145,12 @@ builder.Services.AddSingleton<IAuthorizationHandler, HasScopeHandler>();
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var serviceScope = app.Services
|
||||
.GetRequiredService<IServiceScopeFactory>()
|
||||
.CreateScope();
|
||||
using var context = serviceScope.ServiceProvider
|
||||
.GetService<ApplicationDbContext>();
|
||||
context.Database.Migrate();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(settings =>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user