Table of Contents

Class SchemaStateStore

Namespace
CL.MySQL2.Services
Assembly
CL.MySQL2.dll

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

connectionManager ConnectionManager
logger ILogger

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

connectionId string
ct CancellationToken

Returns

Task<bool>

GetAllAsync(string, CancellationToken)

Returns all recorded state rows, ordered by table name.

public Task<List<SchemaStateRecord>> GetAllAsync(string connectionId = "Default", CancellationToken ct = default)

Parameters

connectionId string
ct CancellationToken

Returns

Task<List<SchemaStateRecord>>

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

tableName string
connectionId string
ct CancellationToken

Returns

Task<SchemaStateRecord>

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

tableName string
connectionId string
ct CancellationToken

Returns

Task<bool>

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

tableName string
schemaCrc string
status SchemaSyncStatus
syncMode string
appVersion string
modelInfo string
connectionId string
ct CancellationToken

Returns

Task<bool>