Local Sync Schema
Component Detail
Data Layer
high complexity
Shared Component
mobile
1
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Drift table definitions that mirror the server schema extended with sync-state columns (sync_status, local_id, server_id, conflict_flag). Provides typed DAOs and Riverpod stream providers that combine local and remote data into a unified offline-first data layer used by all mobile features.
local-sync-schema
Sources & reasoning
A shared schema layer with sync-state columns is required for offline reads to work across all features. Without explicit sync_status and server_id columns per row, the app cannot distinguish locally pending writes from server-confirmed records, making optimistic UI and conflict detection impossible.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Define Drift table classes for all offline-capable entities with sync-state columns
- Provide typed DAO interfaces for local CRUD with sync-state awareness
- Manage SQLite schema migrations across app version upgrades
- Expose Riverpod streams that merge local pending records with server-confirmed data
Interfaces
watchActivities(): Stream<List<LocalActivity>>
watchContacts(): Stream<List<LocalContact>>
upsertEntity(entity: Insertable<T>): Future<void>
markSynced(localId: String, serverId: String): Future<void>
getConflicts(): Future<List<ConflictRecord>>
Relationships
Dependencies (1)
Components this component depends on