Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#23331 closed Bug (invalid)

Circular dependencies are not resolved by new Migrate framework

Reported by: Aidan Lister Owned by: Andrew Godwin
Component: Migrations Version: master
Severity: Normal Keywords: migrate
Cc: aidan@…, Markus Holtermann Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Aidan Lister)

It's very easy and not explicitly not-supported to create circular dependencies in your apps. I have attached a test project which has two circular dependency resolution failures.

This fails to create migrations:

./manage.py makemigrations contractors inspections organisations properties reports tasks timeline

This creates the migrations:

./manage.py makemigrations properties reports tasks timeline
./manage.py makemigrations contractors inspections

But then ./manage.py migrate fails:

django.db.migrations.graph.CircularDependencyError: [('contractors', u'0002_auto_20140821_0156'), ('reports', u'0001_initial'), ('inspections', u'0001_initial'), ('contractors', u'0002_auto_20140821_0156')]

I have tried manually breaking up the migrations into lots of little steps, but you'll have the same problem with the reports and inspections app. Even with lots of tiny migrations it eventually loops around.

Attachments (1)

testproject.zip (46.3 KB) - added by Aidan Lister 2 years ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by Aidan Lister

Attachment: testproject.zip added

comment:1 Changed 2 years ago by Aidan Lister

Description: modified (diff)
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 2 years ago by Andrew Godwin

Resolution: invalid
Status: newclosed

Tried to reproduce from example project, and it worked perfectly with the line:

./manage.py makemigrations tasks timeline organisations reports contractors inspections properties

The generated migrations then also ran successfully.

Closing as INVALID as I suspect this was encountered just before the fixes to #23322 and #23315 landed in master earlier, and in particular #23315 would have manifested as the first command not being able to run.

If you can reproduce this on the most recent commit in master, please reopen and this time provide full console output from when the command runs.

comment:3 Changed 2 years ago by Markus Holtermann

Cc: Markus Holtermann added
Note: See TracTickets for help on using tickets.
Back to Top