SQLite · alpha
note
CN · Constraints & keys
free in the CLI — --engine=sqlite
PRIMARY KEY column that accepts NULL
Note — this works, but it is a documented trap or a cost the author may not have meant.
What it catches
In a rowid table, a PRIMARY KEY column that is not INTEGER does not imply NOT NULL — a long-standing SQLite bug kept for compatibility — so NULL keys are accepted and the uniqueness the key promised is gone (every NULL is distinct). In a WITHOUT ROWID table the same NULL is refused at insert time instead, so the schema behaves differently depending on one table option.
Fires on
CREATE TABLE orders (ref TEXT PRIMARY KEY, qty INTEGER);Do this instead
Spell NOT NULL on every non-INTEGER primary key column so the key is a key.
CREATE TABLE orders (ref TEXT PRIMARY KEY NOT NULL, 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