Django error django.db.migrations.exceptions.InconsistentMigrationHistory
I get the error below whenever I try to migrate my apps to a database.
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency
This error occurs when you change django's defaut user model to a custom user abstract model.
Follow the steps below to solve the error;
- First delete all the migration files execpt the init file across all your apps.
- Comment out the admin.site urls in your projects root urls.py.
- Comment out admin.contrib in settings.py installed apps.
- Run the makemigrations and migrate commands and it should work successfully.
- Then after successful migration uncomment the admin.site url and admin.contrib.
- Finally run makemigrations and migrate again to migrate the admin files and settings.
Click on the button below to add a new message to this thread
Satus: OpenMessages: 1Started: 2022-05-27
Click the button below to start a new thread for your question
By using our website,