using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using StellaOps.Infrastructure.Postgres.Connections; using StellaOps.Infrastructure.Postgres.Options; namespace StellaOps.TimelineIndexer.Infrastructure; /// /// PostgreSQL data source for the Timeline Indexer module. /// Sets the default schema and carries tenant context via app.current_tenant. /// public sealed class TimelineIndexerDataSource : DataSourceBase { public const string DefaultSchemaName = "timeline"; public TimelineIndexerDataSource(IOptions options, ILogger logger) : base(EnsureSchema(options.Value), logger) { } protected override string ModuleName => "TimelineIndexer"; private static PostgresOptions EnsureSchema(PostgresOptions baseOptions) { if (string.IsNullOrWhiteSpace(baseOptions.SchemaName)) { baseOptions.SchemaName = DefaultSchemaName; } return baseOptions; } }