1👍
✅
Data migration is what you need.
- Add new field to the model, apply
makemigrations
. - Create a data migration, which would transfer data from old fields to the new one and run it.
- Remove old fields.
Data migration could be created with:
python manage.py makemigrations --empty yourappname
And inside it you should use RunPython
or RunSQL
depending on what exactly do you need.
Source:stackexchange.com