2👍
✅
Here is a suggestion given on the django doc. You can give it a try. And in short it says:
- First creat a migration that allows the
new_field
to be nullable; - Then create another migration that populates the
new_field
with proper values to every row in the model; - Then another migration which adds the not-null constraint in the column.
Source:stackexchange.com