All rules Rule SL018 · TY
SQLite · alpha
note
TY · Type choices
free in the CLI — --engine=sqlite

AUTOINCREMENT where a plain INTEGER PRIMARY KEY would do

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

What it catches

AUTOINCREMENT makes every insert also update the sqlite_sequence table, and the SQLite manual itself says it should be avoided unless strictly needed. Its one guarantee — a deleted rowid is never reused — is rarely what a migration author meant.

Fires on

CREATE TABLE orders (id INTEGER PRIMARY KEY AUTOINCREMENT, qty INTEGER);

Do this instead

Drop the keyword; INTEGER PRIMARY KEY already assigns increasing rowids. Keep AUTOINCREMENT only when reuse of a deleted id would be a correctness bug.

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