SyncSchema
Creates and manages sync schema tables for SQLite. Implements spec Appendix A schema.
public static class SyncSchema
Methods
CreateSchema(SqliteConnection)
[SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "SQL is composed from const strings only")]
public static Result<bool, SyncError> CreateSchema(SqliteConnection connection)
Creates all sync tables in the database.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Success or database error.
SetOriginId(SqliteConnection, string)
public static Result<bool, SyncError> SetOriginId(SqliteConnection connection, string originId)
Sets the origin ID for this replica. Should be called once on first sync.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
originId |
String |
UUID v4 origin ID. |
Returns: SyncError> - Success or database error.
GetOriginId(SqliteConnection)
public static Result<string, SyncError> GetOriginId(SqliteConnection connection)
Gets the origin ID for this replica.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
SqliteConnection |
SQLite connection. |
Returns: SyncError> - Origin ID or database error.
Values
| Name | Description |
|---|---|
CreateSyncStateTable |
SQL to create sync state table (_sync_state). |
CreateSyncSessionTable |
SQL to create sync session table (_sync_session). |
CreateSyncLogTable |
SQL to create sync log table (_sync_log). |
CreateSyncClientsTable |
SQL to create sync clients table (_sync_clients). |
CreateSyncSubscriptionsTable |
SQL to create sync subscriptions table (_sync_subscriptions). |
CreateMappingStateTable |
SQL to create mapping state table (_sync_mapping_state). |
CreateRecordHashesTable |
SQL to create record hashes table (_sync_record_hashes). |
InitializeSyncState |
SQL to initialize sync state with default values. |