mirror of
https://github.com/fergalmoran/deepsouthsounds.git
synced 2025-12-22 01:42:34 +00:00
Initial
This commit is contained in:
23
dss-api/Services/Startup/DbMigrator.cs
Normal file
23
dss-api/Services/Startup/DbMigrator.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using DSS.Api.Data;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DSS.Api.Services.Startup {
|
||||
internal static class DbMigratorExtensions {
|
||||
internal static void UpdateDatabase(
|
||||
this IApplicationBuilder app,
|
||||
IConfiguration config) {
|
||||
|
||||
using var serviceScope = app.ApplicationServices
|
||||
.GetRequiredService<IServiceScopeFactory>()
|
||||
.CreateScope();
|
||||
|
||||
using var context = serviceScope.ServiceProvider.GetService<DSSDbContext>();
|
||||
context.Database.Migrate();
|
||||
// DSSDbContextInitialiser.SeedUsers(userManager, context, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user