wip: doctor/cli/docs/api to vector db consolidation; api hardening for descriptions, tenant, and scopes; migrations and conversions of all DALs to EF v10

This commit is contained in:
master
2026-02-23 15:30:50 +02:00
parent bd8fee6ed8
commit e746577380
1424 changed files with 81225 additions and 25251 deletions

View File

@@ -1,6 +1,7 @@
// Licensed to StellaOps under the BUSL-1.1 license.
using Dapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using StellaOps.ReachGraph.Persistence.Postgres;
namespace StellaOps.ReachGraph.Persistence;
@@ -16,24 +17,16 @@ public sealed partial class PostgresReachGraphRepository
ArgumentException.ThrowIfNullOrEmpty(tenantId);
await using var connection = await _dataSource
.OpenConnectionAsync(cancellationToken)
.OpenConnectionAsync(tenantId, "writer", cancellationToken)
.ConfigureAwait(false);
await SetTenantContextAsync(connection, tenantId, cancellationToken).ConfigureAwait(false);
await using var dbContext = ReachGraphDbContextFactory.Create(connection, CommandTimeoutSeconds, GetSchemaName());
const string sql = """
DELETE FROM reachgraph.subgraphs
WHERE digest = @Digest
AND tenant_id = @TenantId
RETURNING digest
""";
var affected = await dbContext.Subgraphs
.Where(s => s.Digest == digest && s.TenantId == tenantId)
.ExecuteDeleteAsync(cancellationToken)
.ConfigureAwait(false);
var command = new CommandDefinition(
sql,
new { Digest = digest, TenantId = tenantId },
cancellationToken: cancellationToken);
var deleted = await connection.QuerySingleOrDefaultAsync<string>(command).ConfigureAwait(false);
if (deleted is not null)
if (affected > 0)
{
_logger.LogInformation("Deleted reachability graph {Digest}", digest);
return true;