qa iteration 2

This commit is contained in:
master
2026-03-06 00:40:59 +02:00
parent 360485f556
commit 54753bfd41
5 changed files with 44 additions and 1 deletions

View File

@@ -96,6 +96,21 @@ builder.TryAddStellaOpsLocalBinding("integrations");
var app = builder.Build();
app.LogStellaOpsLocalHostname("integrations");
// Auto-migrate: ensure integrations schema and tables exist on startup
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<IntegrationDbContext>();
try
{
await db.Database.EnsureCreatedAsync();
app.Logger.LogInformation("Integrations database schema ensured");
}
catch (Exception ex)
{
app.Logger.LogWarning(ex, "Integrations database EnsureCreated failed (may already exist)");
}
}
// Configure pipeline
if (app.Environment.IsDevelopment())
{

View File

@@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Infrastructure.Postgres.Migrations;
using StellaOps.Infrastructure.Postgres.Options;
using StellaOps.Notify.Persistence.Postgres;
using StellaOps.Notify.Persistence.Postgres.Repositories;
@@ -26,6 +27,12 @@ public static class NotifyPersistenceExtensions
services.Configure<PostgresOptions>(configuration.GetSection(sectionName));
services.AddSingleton<NotifyDataSource>();
// Auto-migrate notify schema on startup
services.AddStartupMigrations(
schemaName: "notify",
moduleName: "Notify",
migrationsAssembly: typeof(NotifyDataSource).Assembly);
// Register repositories
services.AddScoped<IChannelRepository, ChannelRepository>();
services.AddScoped<IDeliveryRepository, DeliveryRepository>();

View File

@@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using StellaOps.Auth.ServerIntegration;
using StellaOps.Infrastructure.Postgres.Migrations;
using StellaOps.Auth.ServerIntegration.Tenancy;
using StellaOps.Configuration;
using StellaOps.Localization;
@@ -226,6 +227,13 @@ if (!string.IsNullOrWhiteSpace(bootstrapOptions.Storage.PostgresConnectionString
builder.Services.AddSingleton<IAdministrationTrustSigningStore, PostgresAdministrationTrustSigningStore>();
builder.Services.AddSingleton<IPlatformContextStore, PostgresPlatformContextStore>();
builder.Services.AddSingleton<ITranslationStore, PostgresTranslationStore>();
// Auto-migrate platform schemas on startup (release, platform, analytics, shared)
builder.Services.AddStartupMigrations<PlatformServiceOptions>(
schemaName: "release",
moduleName: "Platform.Release",
typeof(StellaOps.Platform.Database.MigrationModuleRegistry).Assembly,
options => options.Storage.PostgresConnectionString!);
}
else
{