“No migrations to apply” while there are changes that are not applied by Django!
Published in
Jan 15, 2024
Issue: Some changes are not being applied from the model to the database in Django. Even Running
./manage.py makemigrations appname
./manage.py migrate appname
multiple times will not help.
When: When adding/removing some fields in the model, changing the table directly in the database, or using a previous name for the app, you may encounter this issue.
Resolution: The following will do the magic
./manage.py makemigrations --empty appname
./manage.py makemigrations appname
Why: There are some caching systems in Django migration. With an empty argument, we are forcing the Django migration to recheck the table and then it finds the new migrations.