#22932: "makemigrations" generates circular dependencies
-------------------------+-------------------------------------------------
     Reporter:  humitos  |      Owner:  nobody
         Type:  Bug      |     Status:  new
    Component:           |    Version:  master
  Migrations             |   Keywords:  circular dependency, migrations,
     Severity:  Normal   |  makemigrations
 Triage Stage:           |  Has patch:  0
  Unreviewed             |      UI/UX:  0
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 I'm having an issue with the new migrations system included in Django. The
 steps that I'm following to reproduce is, once the example project is
 downloaded just run:

  1. manage.py makemigrations
  1. manage.py migrate

 {{{
 Traceback (most recent call last):
   File "/home/humitos/Source/migration_test/manage.py", line 10, in
 <module>
     execute_from_command_line(sys.argv)
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 330, in
 execute_from_command_line
     utility.execute()
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 322, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 363, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 412, in execute
     output = self.handle(*args, **options)
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/core/management/commands/makemigrations.py", line 78, in
 handle
     loader.project_state(),
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/loader.py", line 268, in project_state
     return self.graph.make_state(nodes=nodes, at_end=at_end,
 real_apps=list(self.unmigrated_apps))
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 140, in make_state
     for migration in self.forwards_plan(node):
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 55, in forwards_plan
     return self.dfs(node, lambda x: self.dependencies.get(x, set()))
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 121, in dfs
     return _dfs(start, get_children, [])
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 113, in _dfs
     results = _dfs(n, get_children, path) + results
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 113, in _dfs
     results = _dfs(n, get_children, path) + results
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 113, in _dfs
     results = _dfs(n, get_children, path) + results
   File "/home/humitos/.virtualenvs/tmp-
 e997f5cc453b28eb/local/lib/python2.7/site-
 packages/django/db/migrations/graph.py", line 105, in _dfs
     raise CircularDependencyError(path[path.index(start):] + [start])
 django.db.migrations.graph.CircularDependencyError: [('challenge',
 u'0001_initial'), (u'team', u'0001_initial'), ('challenge',
 u'0001_initial')]
 }}}

 If I remove the {{{myapp.team.TeamCaptain}}} model and the migration files
 already created and I run those commands again, it creates the proper
 migration files and it works.

 I've been taking a look at #22325 but it doesn't seem to be the same
 situation.

 I tried this in Django 1.7b4, 1.7c1 and master and I always got the same
 error.

 What other kind of information can I provide?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22932>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.9f9a076af635aa83c60ab0ccb1a3bb54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to