pythondjangopycharm

Django CircularDependencyError on migrations


I cloned a git repository with a Django app and opened it on Pycharm and made some changes to it.

Among these changes I did add_to_class on the Group class from django, to add a field named modulo.

I closed this project and cloned the repository again, and made all the initial migrations and all. The problem is, when I try to migrate I get this error

django.db.migrations.exceptions.CircularDependencyError: BOXCFG.0001_initial, auth.0010_remove_group_modulo, auth.0009_group_modulo

Seems like the changes I did on the Django native model are still somehow getting in the way of my migrations.

I tried deleting everything, migration history, the table migration field, the folders the database... And I still get this error when trying to make my migrations.

How do I solve this? Where can I clear the Django migrations so that I start all over again without the changes I did in another project?


Solution

  • I just solved the problem. For anyone facing the same issue what I did was delete the migrations that were causing the error in the django\contrib\auth\migrations folder.

    Also deleted them from the pycache.

    After that I deleted the database did the makemigrations on my app again and then did the migrate. Seems like it worked.