问题
This is my workflow, everything seems nice and tidy with makemigrations and migrate. However, I want to start over with my models, so I:
- rm -rf all the migrations file in the django app directory;
- drop all the related tables in the database;
- makemigrations results in new migration files;
But when I want to migrate it into database, it is said No migrations to apply. I think the mechanism behind migrations is that models -> migrations -> database changes, if I drop the latter two it should go over again. Unfortunately it is not.
Django == 1.8.2
CLOSED There is a table called django-migrations tracking all the changes and delete related records and then I could make migrations. Thx to those who helped!
回答1:
There's another table that keeps track of which migrations have been ran for each app, django_migrations. You'll have to reset that in order for django to know you have started over.
if you changed the database already then try running
python manage.py migrate <app> --fake zero
来源:https://stackoverflow.com/questions/31802911/why-there-is-no-migrations-detected-but-i-just-created-new-migrations