我一直在https://docs.djangoproject.com/en/1.7/topics/migrations/阅读有关 django 迁移的信息。我还查看了 github 中 1.7.x 分支上的提交,我知道这个问题可能已经解决。不幸的是,我在运行迁移时仍然遇到错误。--fake 选项给出了相同的错误。
我有以下迁移:
“人”应用迁移:
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
“位置”应用迁移:
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))
现在我运行迁移
./manage.py migrate
这是我得到的错误
django.db.migrations.graph.CircularDependencyError:
[('people', u'0001_initial'), ('locations', u'0001_initial'),
('people', u'0001_initial')]
完整的错误可以在以下位置查看: http: //pastebin.com/jixK6Ve2
我的问题是 django 代码中是否还有需要修复的内容,请参阅固定票:https ://code.djangoproject.com/ticket/22932 。如果没有,是否可以选择将迁移拆分为 2 个或更多步骤以避免循环依赖错误?