Expand description
SQLite connection management, WAL setup, and schema migrations.
This module handles the low-level database lifecycle:
- Opening a connection with the right pragmas for performance and safety.
- Running schema migrations on first open or version upgrade.
- Providing separate read-only connections for the query layer.
§WAL mode
WAL (Write-Ahead Logging) is enabled on every connection. This gives:
- Concurrent readers while the background writer is writing.
- Better write throughput for the batch write pattern.
- Crash safety — no corruption on unclean shutdown.
§Thread safety
rusqlite::Connection is !Send. The writer owns its connection on a
dedicated OS thread. Query commands open their own read-only connections.
Functions§
- open_
connection - Open a SQLite connection with WAL mode and performance pragmas.
- run_
migrations - Run schema migrations to bring the database up to the current version.