I edited a fresh migration file to instead of adding a new field, just rename a field that already exists on the Django Model
This was the only change on this field
migrations.RenameField(
model_name='my_field',
old_name='field_old_name',
new_name='field_new_name',
),
But after running manage.py migrate, I notice that a new field was added (with a default field value) and the old one still there
And when running manage.py makemigrations again, it creates a migration to remove the old field
What I can't do, because I would lose the data
Steps:
- new fields added to model (without removing old one to not break code)
- manage.py makemigrations
- code changed to use new field
- migration file edited to use migrations.RenameField
- manage.py migrate