Change where the MigrationTable are to be created. Improve the update-databases.sh script

This commit is contained in:
Jonathan Bourdon
2024-07-24 16:37:34 -04:00
parent 0faf5a9a0e
commit 042fd53463
4 changed files with 32 additions and 15 deletions

View File

@@ -6,7 +6,9 @@ using Hutopy.Infrastructure.Data;
using Hutopy.Infrastructure.Identity;
using Hutopy.Web;
using Hutopy.Web.Features.Contents;
using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Messages;
using Hutopy.Web.Features.Messages.Data;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.EntityFrameworkCore;
using NSwag;
@@ -73,17 +75,23 @@ builder.Services.AddOpenApiDocument((configure, sp) =>
In = OpenApiSecurityApiKeyLocation.Header,
Description = "Type into the textbox: Bearer {your JWT token}.",
});
configure.OperationProcessors.Add(new AspNetCoreOperationTagsProcessor());
configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("JWT"));
});
var postgresConnectionString = builder.Configuration.GetConnectionString("PostgresConnection")
?? throw new InvalidOperationException("Missing ConnectionStrings:PostgresConnection");
?? throw new InvalidOperationException("Missing ConnectionStrings:PostgresConnection");
builder.Services.AddFastEndpoints();
builder.Services.AddContentModule(options => options.UseNpgsql(postgresConnectionString));
builder.Services.AddMessagingModule(options => options.UseNpgsql(postgresConnectionString));
builder.Services.AddContentModule(options =>
options.UseNpgsql(
postgresConnectionString,
o => o.MigrationsHistoryTable("__EFMigrationsHistory", ContentDbContext.SchemaName)));
builder.Services.AddMessagingModule(options =>
options.UseNpgsql(
postgresConnectionString,
o => o.MigrationsHistoryTable("__EFMigrationsHistory", MessagingDbContext.SchemaName)));
builder.Services.Configure<JwtOptions>(builder.Configuration.GetRequiredSection(JwtOptions.SectionName));