Wrap up a zero-downtime migration: back-fill is done
In events (the pipeline log table) a processed BOOLEAN column was first added without not-null — intentionally, so a background backfill of existing rows wouldn't block writes in production. The backfill is now done, and it's time to make the column required. Sequence: build events with id (primary key) and payload (text), insert two test rows.
Add processed BOOLEAN without not-null — old rows end up with NULL. Run the backfill: set FALSE for every row whose value is still empty. Only then make the column not-null — otherwise the not-null step blows up on those same old rows. Classic zero-downtime migration pattern.
Just CREATE/ALTER/DROP — no trailing SELECT needed.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inNo starting schema
This task starts with no tables — you'll create them via CREATE TABLE.