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


message profile

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 urls in your projects root
  • Comment out admin.contrib in installed apps.
  • Run the makemigrations and migrate commands and it should work successfully.
  • Then after successful migration uncomment the url and admin.contrib.
  • Finally run makemigrations and migrate again to migrate the admin files and settings.



Add Message

Click on the button below to add a new message to this thread


Thread detail

Satus: Open
Messages: 1Started: 2022-05-27




Frontend Development |Backend Development |Full Website Development |Bootstrap Website upgrades | Website Debbugging | Website Hosting & deployment


Interested in hiring me or collaborating with me on a project, click on any of the links below to get my social media handle

Or contact me via Tel: (+234)-806-225-7480 | Email:
Privacy Policy

By using our website,
you agree that devmaesters can store cookies on your device and disclose information in accordance with our privacy policy.