local_first_sqlite_storage 0.4.2
local_first_sqlite_storage: ^0.4.2 copied to clipboard
SQLite adapter for local_first: structured tables, indexes, and filtered queries.
0.4.2 #
- Table/schema verification (
_ensureTables) now runs once per repository per open and concurrent first touches share one run. Previously every CRUD/query call re-ran thePRAGMA table_info+CREATE INDEXpass, and N concurrent calls on a table that needed a column migration all read the PRAGMA before anyALTER TABLEran — all but the first then failed withduplicate column name, while the others queued behind the lock ("database has been locked for 10s"). Seen in the chat app when several chats loaded their history at once after a schema that addedchat_id. - The column migration tolerates a
duplicate columnerror from a competing verification (e.g. one running inside a transaction, which cannot join the shared run without deadlocking) instead of surfacing it. - The memo is reset by
close()(namespace switch) and byensureSchema()(a re-declared schema may need new columns).
0.4.1 #
- Implemented
LocalFirstStorage.runInTransaction: applies a batch inside a singledb.transaction, routing all CRUD/queries through the transaction executor so the whole batch commits once (a single fsync) and rolls back atomically on error. Watcher notifications are deferred and flushed once after commit instead of re-emitting on every write. getAllEventsnow accepts an optionaldataIdand pushes it down to a SQLWHERE, so callers that only need one record's history don't scan the whole event log.- Together these make a large cold sync dramatically faster on slower devices (profiling: applying ~98 records ~8s → ~3s), by cutting per-row fsyncs and redundant watcher re-queries.
- Added an indexed
getById(primary-key lookup) andwatchChanges, a broadcast change signal per namespace, plus optional query profiling. Kept WAL journal mode after A/B profiling (WAL ~2121ms vs DELETE ~2437ms on the sync-apply benchmark). - Schema-driven migration: a table created by an older app version is upgraded in
place (
ALTER TABLE+ backfill) when its schema gains columns, instead of failing on the missing column. - Reads (
getById/getAll/getAllEvents/getEventById) now retry on the base connection when a concurrentrunInTransactionbatch commits/closes the shared transaction mid-read (transaction_closed) instead of throwing — e.g. a read triggered while a reconnect sync storm is applying a batch.
0.4.0 #
- Added
setPassword()to allow changing the SQLCipher encryption password at runtime. - Fixed
database_closedrace condition during namespace switch. - Fixed
SqlCipherOpenDatabaseOptionsusage and improved namespace switch protection. - Updated documentation with encryption setup and ProGuard configuration.
0.3.0 #
- Enhanced SQL query construction for better performance
- Fixed handling of lastEventId field in insert and upsert operations
- Improved query observer implementation with proper type preservation
- Fixed includeDeleted filter argument ordering in SQL queries
- Updated dependency: local_first ^0.7.0
0.2.0 #
- Add supported config types table and example app/run instructions to README.
- Link to root contributing guide; keep docs aligned with other adapters.
0.1.0 #
- Fix pubspec metadata and align workspace configuration.
- Bundle example app copy configured for the SQLite adapter.
0.0.1 #
- Initial release of the SQLite adapter for local_first.
- Supports schema/index creation, rich filtering/sorting, metadata storage, and reactive queries.