SQLite through Effect SQL; Drizzle deferred
- Status: accepted
- Date: 2026-10-03
Context and problem statement
Section titled “Context and problem statement”The kernel persists sessions, events and asks in SQLite and must run inside a compiled Bun binary while its tests run under Node (Vitest). Drizzle ORM was the planned query layer, but on 2026-10-02 its Effect drivers (drizzle-orm@1.0.0-rc.4) do not load against effect@4.0.0, its node:sqlite driver exists only in the 1.0 release candidates, and its migrator reads migration files from disk, which a compiled binary does not ship.
Decision
Section titled “Decision”packages/kernel talks to SQLite through effect/sql with @effect/sql-sqlite-bun in the binary and @effect/sql-sqlite-node (built on node:sqlite) under Vitest — the same SqlClient API, verified to behave identically. Migrations are embedded SQL strings applied once each in a transaction and recorded in bb_migrations. Row mapping is explicit per service; effect/Schema validates payloads at the boundaries.
Consequences
Section titled “Consequences”No typed query builder; queries are reviewed as SQL. Revisit Drizzle (schema as source of truth, drizzle-kit generate for migrations) once a stable release loads on Effect 4 and offers a node:sqlite driver. Node 24 prints an ExperimentalWarning for node:sqlite that the Vitest project silences.