Expand description
Budget-family SQL — SQLite dialect port of
ff-backend-postgres/src/budget.rs raw-SQL constants.
RFC-023 Phase 3.4 / RFC-020 Wave 9 Standalone-1.
Placeholders are ?-positional to match sqlx-sqlite; the PG
reference uses $1..$N. Table shapes are identical (see
migrations/0002_budget.sql + migrations/0013_budget_policy_extensions.sql).
Lock-mode note. The PG reference uses FOR NO KEY UPDATE to
serialise the breach-UPDATE path. SQLite’s single-writer invariant
(BEGIN IMMEDIATE acquires RESERVED) already serialises any two
writers on the same connection pool, so no row-level locking hint
is emitted. Write paths wrap in retry_serializable to absorb
SQLITE_BUSY under contention per RFC-023 §4.3.