SQLite · alpha
note
TY · Type choices
free in the CLI — --engine=sqlite
INT PRIMARY KEY is not a rowid alias
Note — this works, but it is a documented trap or a cost the author may not have meant.
What it catches
Only a column declared exactly INTEGER PRIMARY KEY becomes an alias for the rowid. INT PRIMARY KEY (or BIGINT, or INTEGER PRIMARY KEY DESC) is an ordinary column with a separate unique index: every lookup by primary key is an extra B-tree hop, the value is not the rowid, and VACUUM may renumber the real rowid underneath it.
Fires on
CREATE TABLE orders (id INT PRIMARY KEY, qty INTEGER);Do this instead
Spell the type INTEGER, exactly, on the primary key column of a rowid table.
CREATE TABLE orders (id INTEGER PRIMARY KEY, qty INTEGER);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