[Fixed]-Revert migration on deleted not null field


That’s tricky. The only solution I can think of is the following:

1: First, create a migration that allows the slug field to be nullable

2: Then, create another migration that will populate the field for every row

3: Lastly, create a migration that makes the field non-nullable.

Hope it helps


There is an easier way:

  1. Find migration where you have initially add slug field
  2. Add default value to slug field
  3. Unapply last migration
  4. Remove default value from initial slug field migration

Leave a comment