All rules Rule SL035 · OP
SQLite · alpha
note
OP · Operational safety
free in the CLI — --engine=sqlite

Connection-scoped pragma in a migration

Note — this works, but it is a documented trap or a cost the author may not have meant.

What it catches

cache_size, synchronous, temp_store, mmap_size and busy_timeout live on the connection that set them. In a migration they tune the runner's connection for a few seconds and reach the application never — and synchronous=OFF removes durability for exactly the connection doing the schema change.

Fires on

PRAGMA synchronous = OFF;
PRAGMA mmap_size = 268435456;
ALTER TABLE orders ADD COLUMN region TEXT;

Do this instead

Set connection pragmas where connections are opened, in the application, so every connection gets them. Leave migrations to the schema.

ALTER TABLE orders ADD COLUMN region TEXT;
-- application connection setup: PRAGMA synchronous = NORMAL; PRAGMA mmap_size = 268435456;
Catch this before it ships

SQLite support is in alpha: this rule runs locally in the free CLI, static only, and not in the hosted service yet: npx bolvrk check migration.sql --engine=sqlite