Cyclic dependency error when migrating to Django 1.7c2

I read about django migration at https://docs.djangoproject.com/en/1.7/topics/migrations/ . I also reviewed the commits on the 1.7.x branch on github, where I understand that this problem may have been resolved. Unfortunately, I still get an error while performing my migrations. The --fake option gives the same error.

I have the following migrations:

'migration of applications for people:

user@host $ /manage.py makemigrations people Migrations for 'people': 0001_initial.py: - Create model Person - Create model Committee - Create model DepartmentGroup - Add field department_group to person - Create model MemberType - Add field member_type to person - Alter unique_together for person (1 constraint(s)) - Create model PersonCommittee - Add field committees to committee - Add field committee to personcommittee - Add field member to personcommittee - Alter unique_together for personcommittee (1 constraint(s)) - Create model Role - Create proxy model PersonArchive 

'' application migration in places:

 user@host $ ./manage.py makemigrations locations Migrations for 'locations': 0001_initial.py: - Create model Building - Create model Institution - Create model InstitutionAddress - Add field institution to building - Add field address to institutionaddress - Add field institution to institutionaddress - Create model Room - Alter unique_together for room (1 constraint(s)) 

Now I run migrations using

 ./manage.py migrate 

and this is the error i get

 django.db.migrations.graph.CircularDependencyError: [('people', u'0001_initial'), ('locations', u'0001_initial'), ('people', u'0001_initial')] 

The full error can be viewed at: http://pastebin.com/jixK6Ve2

My question is if there is anything in the django code that needs to be fixed, see the fixed ticket: https://code.djangoproject.com/ticket/22932 . If not, is it possible to divide the migration into 2 or more steps to avoid cyclic dependency errors?

+6
source share
1 answer

The actions pointed out by the humitos user from https://code.djangoproject.com/ticket/22932#comment:4 seem to have solved the problem.

I basically needed to remove the hovering dependency and the conflicting model and put them in a new empty migration.

+5
source

Source: https://habr.com/ru/post/973779/


All Articles