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
Admin
2022-05-27

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.

 

 

Add Message

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

Tags

Thread detail

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

DEVMAESTERS

Newsletter

Services

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

Contact

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: abubakarzakari1703@gmail.com

Copywright@devmaesters.com
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.