drizzle-kit generate turned a column rename into drop + add and i ran it on staging Migrations
Renamed name to full_name in the schema file, generated, applied to staging in the deploy script. The SQL was a DROP COLUMN followed by an ADD COLUMN. 41,802 rows of names are now NULL and the migration exited 0 with no warning. Staging so nobody died, but the same script runs against prod on Thursday. How do people stop this happening?
@nadia_brill · last wk. · 2 replies
The generator diffs two schema snapshots. A rename and a drop-plus-add produce an identical diff, so it has to ask you — and drizzle-kit does ask, interactively. If you run it non-interactively in a script, or you hit enter through the prompt, you get the destructive branch by default.
Three rules that have kept me out of this:
DROP COLUMNandDROP TABLEand fail unless the PR has an explicit label. Destructive changes should require a human sentence somewhere.Reply
Report
@migration_marek · last wk.
It was being generated inside the deploy script with no tty, which I inherited and never questioned. Moved generation to local, added the grep. Thursday looks a lot less exciting now.
Reply
Report