Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#34247 closed Bug (needsinfo)

Cannot resolve operation dependencies

Reported by: Mike Schem Owned by: nobody
Component: Migrations Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've been having trouble regenerating all my Django migrations from scratch. We have hundreds of models and many complex relationships. I kept getting the error Cannot resolve operation dependencies when generating and I noticed that proxy models that were foreign keys of other models seemed to be the culprit. I've created a pr to fix the sort method to ensure that proxy model based CreateModel and regular model CreateModel operations are at the top.

https://github.com/django/django/pull/16438

Change History (4)

comment:1 by Tim Graham, 23 months ago

Easy pickings: unset
Needs tests: set

You'll need to provide a minimal example to reproduce the issue so we can better understand it. The patch also requires a regression test based on that.

comment:2 by Mariusz Felisiak, 23 months ago

Resolution: needsinfo
Status: newclosed

in reply to:  1 comment:3 by Mike Schem, 23 months ago

Replying to Tim Graham:

You'll need to provide a minimal example to reproduce the issue so we can better understand it. The patch also requires a regression test based on that.

Yea, I've tried to come up with something, but no luck so far. I've only been able to get this to fail on my project, and like I said, it has hundreds of objects with complex relations. The code does fix the problem and I see no downside to ordering proxy model and model creates at the top before the sort, any reason not to just accept the PR?

Not sure if I'll be able to come up with something here.

comment:4 by Tim Graham, 23 months ago

We can't add code for a problem we don't fully understand, or else Django would quickly become a mess. Without a test, we can't be sure the problem is fixed and that the behavior won't regress in the future.

Note: See TracTickets for help on using tickets.
Back to Top