All rules Rule SL014 · LK
SQLite · alpha
warning
LK · Locks & blocking
free in the CLI — --engine=sqlite

VACUUM in a migration

Warning — it works, but holds the single write lock or breaks the previous release.

What it catches

VACUUM rewrites the entire database file into a temporary copy and swaps it in: it needs up to twice the database's size in free disk space, holds the write lock for the whole rewrite, and fails outright if a transaction is open on the connection — so inside a migration runner's transaction it is an error, and outside one it is an outage-sized pause.

Fires on

VACUUM;

Do this instead

Vacuum from an operational job in a maintenance window, never from a migration. If space reclaim must be continuous, PRAGMA auto_vacuum=INCREMENTAL with incremental_vacuum in small steps.

-- operational runbook, not a migration:
--    sqlite3 app.db 'VACUUM;'
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