All rules Rule SL023 · DS
SQLite · alpha
critical
DS · Destructive changes
free in the CLI — --engine=sqlite

Dropping what a view or trigger in this migration depends on

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

What it catches

This migration creates a view or trigger and then drops the table or column it depends on. SQLite does not stop it: the view fails with "no such column" the first time it is queried, and a trigger that names the column makes every later write to its table fail. Older releases refuse the DROP COLUMN instead. Either way the failure is guaranteed by the file itself, not by what production holds.

Fires on

CREATE VIEW open_orders AS SELECT id, status FROM orders WHERE status = 'open';
ALTER TABLE orders DROP COLUMN status;

Do this instead

Drop or redefine the view or trigger first, then drop the column or table, then recreate the view without the dependency.

DROP VIEW IF EXISTS open_orders;
ALTER TABLE orders DROP COLUMN status;
CREATE VIEW open_orders AS SELECT id FROM orders;
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