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
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-27loading..
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.