fix(orchestrator): scripts auto-migration with dedicated options and DI module

Scripts module now owns its PostgreSQL schema lifecycle: ScriptsPostgresOptions,
ServiceCollectionExtensions.AddReleaseOrchestratorScripts(), embedded SQL migration,
and MigrationServiceExtensions fix to register multiple IHostedService migrations
without deduplication. Fresh installs auto-converge the scripts catalog without
depending on Scheduler-owned bootstrap SQL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-10 12:28:52 +03:00
parent 9820b48372
commit 36eaf5e798
10 changed files with 327 additions and 32 deletions

View File

@@ -36,7 +36,9 @@ public static class MigrationServiceExtensions
var migrationOptions = new StartupMigrationOptions();
configureOptions?.Invoke(migrationOptions);
services.AddHostedService(sp =>
// Multiple modules can own distinct schemas inside one service host.
// Register each migration host explicitly so they do not get deduplicated.
services.AddSingleton<IHostedService>(sp =>
{
var options = sp.GetRequiredService<IOptions<TOptions>>().Value;
var connectionString = connectionStringSelector(options);