perf(kpi-history): time-sliced batched purge replaces the single daily mega-DELETE

This commit is contained in:
Joseph Doherty
2026-07-09 09:06:42 -04:00
parent 5332912f26
commit 71189298a2
4 changed files with 116 additions and 5 deletions
@@ -87,6 +87,25 @@ public static class SqliteTestHelper
return context;
}
/// <summary>
/// In-memory SQLite context with EF command interceptors attached — lets a
/// test observe the actual SQL a repository emits (e.g. count DELETE statements
/// issued by a batched purge).
/// </summary>
public static ScadaBridgeDbContext CreateInMemoryContext(params IInterceptor[] interceptors)
{
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
.UseSqlite("DataSource=:memory:")
.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning))
.AddInterceptors(interceptors)
.Options;
var context = new SqliteTestDbContext(options);
context.Database.OpenConnection();
context.Database.EnsureCreated();
return context;
}
public static ScadaBridgeDbContext CreateFileContext(string dbPath)
{
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()