mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-17 10:50:45 +02:00
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Reflection;
|
||||
using API;
|
||||
using API.Schema.ActionsContext;
|
||||
using API.Schema.ActionsContext.Actions;
|
||||
using API.Schema.LibraryContext;
|
||||
using API.Schema.MangaContext;
|
||||
using API.Schema.NotificationsContext;
|
||||
@@ -92,6 +94,8 @@ builder.Services.AddDbContext<NotificationsContext>(options =>
|
||||
options.UseNpgsql(connectionStringBuilder.ConnectionString));
|
||||
builder.Services.AddDbContext<LibraryContext>(options =>
|
||||
options.UseNpgsql(connectionStringBuilder.ConnectionString));
|
||||
builder.Services.AddDbContext<ActionsContext>(options =>
|
||||
options.UseNpgsql(connectionStringBuilder.ConnectionString));
|
||||
|
||||
builder.Services.Configure<Microsoft.AspNetCore.Http.Json.JsonOptions>(options =>
|
||||
{
|
||||
@@ -180,6 +184,15 @@ try //Connect to DB and apply migrations
|
||||
|
||||
await context.Sync(CancellationToken.None, reason: "Startup library");
|
||||
}
|
||||
|
||||
using (IServiceScope scope = app.Services.CreateScope())
|
||||
{
|
||||
ActionsContext context = scope.ServiceProvider.GetRequiredService<ActionsContext>();
|
||||
await context.Database.MigrateAsync(CancellationToken.None);
|
||||
context.Actions.Add(new StartupActionRecord());
|
||||
|
||||
await context.Sync(CancellationToken.None, reason: "Startup actions");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user