Class SchemaStateStore
Owns the __schema_state sentinel table: one row per model holding a CRC of the model's
desired schema plus reconciliation status and audit metadata. The CRC lets schema sync skip a
table entirely (no information_schema diffing) when nothing has changed.
public sealed class SchemaStateStore
- Inheritance
-
SchemaStateStore
- Inherited Members
Constructors
SchemaStateStore(ConnectionManager, ILogger?)
public SchemaStateStore(ConnectionManager connectionManager, ILogger? logger = null)
Parameters
connectionManagerConnectionManagerloggerILogger
Methods
EnsureStateTableAsync(string, CancellationToken)
Ensures the __schema_state table exists. Call once during library initialization.
public Task<bool> EnsureStateTableAsync(string connectionId = "Default", CancellationToken ct = default)
Parameters
connectionIdstringctCancellationToken
Returns
GetAllAsync(string, CancellationToken)
Returns all recorded state rows, ordered by table name.
public Task<List<SchemaStateRecord>> GetAllAsync(string connectionId = "Default", CancellationToken ct = default)
Parameters
connectionIdstringctCancellationToken
Returns
GetStateAsync(string, string, CancellationToken)
Returns the recorded state for a table, or null if none.
public Task<SchemaStateRecord?> GetStateAsync(string tableName, string connectionId = "Default", CancellationToken ct = default)
Parameters
tableNamestringconnectionIdstringctCancellationToken
Returns
RemoveStateAsync(string, string, CancellationToken)
Removes the state row for a table (e.g. after a manual restore).
public Task<bool> RemoveStateAsync(string tableName, string connectionId = "Default", CancellationToken ct = default)
Parameters
tableNamestringconnectionIdstringctCancellationToken
Returns
UpsertStateAsync(string, string, SchemaSyncStatus, string, string?, string?, string, CancellationToken)
Inserts or updates the state row for a table.
public Task<bool> UpsertStateAsync(string tableName, string schemaCrc, SchemaSyncStatus status, string syncMode, string? appVersion = null, string? modelInfo = null, string connectionId = "Default", CancellationToken ct = default)
Parameters
tableNamestringschemaCrcstringstatusSchemaSyncStatussyncModestringappVersionstringmodelInfostringconnectionIdstringctCancellationToken