datum_sqlite 1.1.0
datum_sqlite: ^1.1.0 copied to clipboard
A SQLite-backed persistence layer for the Datum ecosystem — native SQL query pushdown, real transactions, and ALTER TABLE schema migrations via SqlMigrationExecutor.
1.1.0 #
- Initial release.
- Fix — rows are keyed by
(id, userId): the table usedid TEXT PRIMARY KEY, so one user'sINSERT OR REPLACEsilently overwrote another user's row with the same entity id, anddeleteremoved every user's row after verifying only one. Fresh tables get a compositePRIMARY KEY (id, userId); legacy tables are rebuilt in a transaction oninitialize()preserving every row and column (including columns added by manual migrations), anddeletescopes by owner. - Fix — per-listener watch streams:
watchAll/watchById/watchQuerynow deliver a current snapshot to every listener (a second concurrent listener previously stayed silent until the next write) and honorincludeInitialData: false. Certified byrunWatchConformanceTests. - Fix — user scoping under OR queries: the
userIdscope filter was appended flat to the query's filter list, so withLogicalOperator.orit became just another OR alternative — returning OTHER USERS' rows (cross-tenant leak) plus same-user rows that didn't match the filters. The caller's filters are now wrapped in a composite that always ANDs with the scope. - Fix — query filter values are encoded:
DateTime(andbool) filter values were handed raw to sqlite3's binder, which rejectsDateTimewith anArgumentError; they now go through the same codec as the write path. - Runtime schema support: optional
schema:derives the payload columns from aDatumSchema(explicitcolumns:still wins), andstrictColumns: trueturns the historical silent drop of undeclared payload keys into an error. Mixes inSqlSchemaCapable+SchemaFingerprintCapable, soDatumConfig.autoMigratereconciles the table with real DDL and skips unchanged launches via the fingerprint stored in the meta table. SqliteLocalAdapter— fullLocalAdapterimplementation overpackage:sqlite3with nativeDatumQuery→ SQL pushdown, realBEGIN/COMMIT/ROLLBACKtransactions, change-notified watch streams, andRawQueryCapablesupport soSqlMigrationExecutorrunsSchemaMigrationchains as realALTER TABLE/UPDATEstatements.- Certified by the
datum_testconformance suite.