PersistedOperationsDbContext

Focused EF Core context for trax.persisted_operation and trax.persisted_operation_history. Kept separate from Trax.Effect.Data.DataContext so the GraphQL feature does not pollute the train/manifest tracking layer.

Registered as IDbContextFactory<PersistedOperationsDbContext> by UsePersistedOperations.

DbSets

DbSetTypeTable
PersistedOperationsDbSet<PersistedOperation>trax.persisted_operation
PersistedOperationHistoriesDbSet<PersistedOperationHistory>trax.persisted_operation_history

Direct usage

For most consumers, IPersistedOperationStore is the right entry point. Read directly from the DbContext only when you need raw EF features:

var factory = sp.GetRequiredService<IDbContextFactory<PersistedOperationsDbContext>>();
await using var ctx = await factory.CreateDbContextAsync(ct);
 
var history = await ctx
    .PersistedOperationHistories
    .Where(h => h.Id == "userProfile_v1")
    .OrderByDescending(h => h.ChangedAt)
    .Take(10)
    .ToListAsync(ct);

PersistedOperationHistory properties

PropertyTypeColumnNotes
HistoryIdlonghistory_idSurrogate key (bigserial).
TenantKeystring?tenant_keyMirrors the live row.
IdstringidMirrors the live row.
DocumentstringdocumentSnapshot at the time of the change.
ShapeFingerprintstringshape_fingerprintSnapshot at the time of the change.
ChangeTypestringchange_typeOne of Upsert, Deactivate, Restore.
ChangedAtDateTimechanged_atUTC.
ChangedReasonstring?changed_reasonRequired on deactivate.