SQLite · alpha
critical
CN · Constraints & keys
free in the CLI — --engine=sqlite
ADD COLUMN with a non-constant default
Critical — SQLite refuses the statement, so the migration fails here.
What it catches
A column added with ALTER TABLE may not default to CURRENT_TIME, CURRENT_DATE, CURRENT_TIMESTAMP or a parenthesised expression: SQLite rejects the statement ("Cannot add a column with non-constant default"). The pattern is common in migrations ported from Postgres, where it works.
Fires on
ALTER TABLE orders ADD COLUMN created_at TEXT DEFAULT CURRENT_TIMESTAMP;Do this instead
Add the column with a constant default (or none), and set the timestamp from application code or a trigger. If the default must be an expression, the column has to be part of a table rebuild.
ALTER TABLE orders ADD COLUMN created_at TEXT;
-- then, from the application or a trigger:
-- UPDATE orders SET created_at = CURRENT_TIMESTAMP WHERE created_at IS NULL;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