#23322 closed Bug (fixed)
CircularDependencyError in migrations
Reported by: | Gabe Jackson | Owned by: | Markus Holtermann |
---|---|---|---|
Component: | Migrations | Version: | 1.7-rc-2 |
Severity: | Release blocker | Keywords: | migrations, circular dependency |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.db.migrations.graph.CircularDependencyError
Test Project is located here: https://github.com/gabejackson/django-migration-test/tree/circ_dep_1
Steps to reproduce:
Install stable/1.7.x branch in venv
./manage.py makemigrations
... [OK]
./manage.py migrate
Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/gabejackson/venv/django-1.7/src/django/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/Users/gabejackson/venv/django-1.7/src/django/django/core/management/__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/gabejackson/venv/django-1.7/src/django/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/Users/gabejackson/venv/django-1.7/src/django/django/core/management/base.py", line 338, in execute output = self.handle(*args, **options) File "/Users/gabejackson/venv/django-1.7/src/django/django/core/management/commands/migrate.py", line 106, in handle plan = executor.migration_plan(targets) File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/executor.py", line 49, in migration_plan for migration in self.loader.graph.forwards_plan(target): File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 55, in forwards_plan return self.dfs(node, lambda x: self.dependencies.get(x, set())) File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 121, in dfs return _dfs(start, get_children, []) File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 113, in _dfs results = _dfs(n, get_children, path) + results File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 113, in _dfs results = _dfs(n, get_children, path) + results File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 113, in _dfs results = _dfs(n, get_children, path) + results File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 113, in _dfs results = _dfs(n, get_children, path) + results File "/Users/gabejackson/venv/django-1.7/src/django/django/db/migrations/graph.py", line 105, in _dfs raise CircularDependencyError(path[path.index(start):] + [start]) django.db.migrations.graph.CircularDependencyError: [(u'a', u'0001_initial'), ('c', u'0001_initial'), (u'b', u'0001_initial'), (u'a', u'0001_initial')]
Change History (9)
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I can confirm the bug. I'm working on a fix.
comment:4 by , 10 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Here's the pull request. Needs some tests though: https://github.com/django/django/pull/3093
comment:5 by , 10 years ago
Without a small test case writing a test is going to be very hard. I can have a go if you're willing to assign the ticket to me.
comment:7 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Added a Graph of the Models if that helps anybody: https://github.com/gabejackson/django-migration-test/blob/circ_dep_1/models.pdf
CAUTION: Custom user model in effect.