I have a question about the order in which tables are created in a migration. As there is a ForeignKey
in model B to connect to model A, I create models with order of A, B and C in models.py. Then:
python manage.py makemigrations app
There is the migration file generated to create all the models, but the order is:
- Create model B
- Create model C
- Create model A
- Add field a_name to b.
As the order in models.py really matters, but why doesn't makemigrations
follow the given order?