Skip to main content

Module pool

Module pool 

Source
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, and runs any pending migrations. This is the only supported way to get a SqlitePool in 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.