[Answered ]-Create new Django model int field from existing bool fields

1👍

Data migration is what you need.

  1. Add new field to the model, apply makemigrations.
  2. Create a data migration, which would transfer data from old fields to the new one and run it.
  3. 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.

Leave a comment