All rules Rule SL001 · CN
SQLite · alpha
critical
CN · Constraints & keys
free in the CLI — --engine=sqlite

ADD COLUMN NOT NULL without a default

Critical — SQLite refuses the statement, so the migration fails here.

What it catches

SQLite refuses to add a NOT NULL column unless it has a default other than NULL — the statement fails with "Cannot add a NOT NULL column with default value NULL", so the migration stops here in every environment, including the one that matters.

Fires on

ALTER TABLE orders ADD COLUMN region TEXT NOT NULL;

Do this instead

Give the column a non-NULL default, or add it nullable, backfill, and enforce NOT NULL by rebuilding the table later. In SQLite a default on ADD COLUMN is free: existing rows are not rewritten, the default is read from the schema.

ALTER TABLE orders ADD COLUMN region TEXT NOT NULL DEFAULT 'eu';
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