You
Why is the migration failing?
Assistant
The unique index is created before the backfill runs, so rows still holding a null email collide.
You
Can you reorder it?
Assistant
Yes. Moving the backfill above the index is enough, and the test suite passes after that.
You
What about existing rows?
Assistant
They are covered by the same backfill, so nothing else needs to change.