SPB Git

Repository Public License

0004-sqlite-access.md 1.1 KB 14 lines markdown

1# ADR 0004 — SQLite access layer23**Status:** accepted (2026-11-22)45## Decision6A thin wrapper (`SQLiteDatabase`, about 150 lines) over the system `SQLite3` module: prepared statements, typed binding of `JSONValue`, row decoding, `transaction { }`, WAL for file databases, a 5 s busy timeout. One connection per store, serialized by a recursive lock. No ORM, no third-party library.78- App data: one database per app (`AppDataStore`). Schema follows the blueprint with **additive** migrations only (create table, add column); nothing is dropped, which is what makes blueprint rollback lossless.9- PRISM metadata: `ProjectStore` with numbered migrations tracked in `PRAGMA user_version`.10- Queries from blueprints are declarative objects compiled to parameterized SQL over identifiers validated against the schema and quoted; values are always bound. Blueprints never contain SQL.1112## Consequences13Queries run synchronously on the calling thread (the main actor for UI). Measured on this Mac this is well under a frame for 10,000 rows; moving heavy queries off the main thread is deferred until profiling asks for it.14
Files main
Menu

Theme