Clear Migration in django
Now you will need to clear the migration history app by app.
First run the showmigrations command so we can keep track of what is going on:
$ python manage.py showmigrations
Result:
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
core
[X] 0001_initial
[X] 0002_remove_mymodel_i
[X] 0003_mymodel_bio
sessions
[X] 0001_initial
Clear the migration history (please note that core is the name of my app):
$ python manage.py migrate --fake core zero
The result will be something like this:
Operations to perform:
Unapply all migrations: core
Running migrations:
Rendering model states... DONE
Unapplying core.0003_mymodel_bio... FAKED
Unapplying core.0002_remove_mymodel_i... FAKED
Unapplying core.0001_initial... FAKED
Now run the command showmigrations again:
$ python manage.py showmigrations
Result:
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
core
[ ] 0001_initial
[ ] 0002_remove_mymodel_i
[ ] 0003_mymodel_bio
sessions
[X] 0001_initial
To re-migrate the app
$ python manage.py makemigrations
$ python manage.py migrate