Local Database Infrastructure
Component Detail
Infrastructure
high complexity
Shared Component
mobile
0
Dependencies
5
Dependents
2
Entities
0
Integrations
Description
Bootstraps and manages the on-device SQLite database using the drift (formerly moor) package for Flutter. Defines the full local schema mirroring the server subset needed for offline operation, manages schema migrations across app versions, and provides the shared drift database instance used by all repositories. Handles database initialization on first launch and migration on upgrades.
local-database-infrastructure
Responsibilities
- Define drift table schemas for activities, contacts, peer_mentors, activity_types, settings, and offline_queue
- Execute incremental schema migrations on app upgrade without data loss
- Expose the singleton drift AppDatabase instance to all repository DAOs
- Configure SQLite pragmas (WAL mode, foreign keys) for performance and integrity
Interfaces
AppDatabase.getInstance(): AppDatabase
AppDatabase.close(): Future<void>
AppDatabase.transaction(action): Future<T>
runMigrations(from: int, to: int): Future<void>
getDatabaseVersion(): Future<int>
getDatabasePath(): Future<String>
deleteDatabase(): Future<void>
exportDatabaseDump(): Future<Uint8List>
Relationships
Dependents (5)
Components that depend on this component
Related Data Entities (2)
Data entities managed by this component