Expand description
Database connection setup: WAL journal mode, a busy timeout (so concurrent CLI + GUI
access to the same file doesn’t immediately error out with SQLITE_BUSY), and
foreign-key enforcement (off by default in SQLite, and required here since every child
table relies on ON DELETE CASCADE/ON DELETE SET NULL).
Functions§
- connect
- Opens (creating if missing) the SQLite database at
path, applies the standard pragmas, rejects incompatible migration histories, and runs pending migrations. This is the only supported way to get aSqlitePoolin bhtune — every caller (CLI, web server, tests) goes through this function so the pragmas and migration state can never drift between adapters. - connect_
in_ memory - Opens a private, in-process database for tests: same pragmas and migrations as
connect, but nothing touches disk. - connect_
read_ only - Opens an existing SQLite database without creating it or applying migrations.
- database_
path - Returns the filesystem path attached to SQLite’s
maindatabase, orDbError::DatabasePathUnavailablefor private in-memory databases. Live controller mutations require this stable identity to acquire process-shared ownership. Callers canonicalize the returned path before comparing filesystem aliases.