Opened 2 years ago

Last modified 8 months ago

#23337 new Bug

CircularDependencyError when squashing migrations

Reported by: Richard Eames Owned by: nobody
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: info+coding@…, python@…, tarkatronic@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Project layout:

.
├── cheese
│   ├── init.py
│   ├── migrations
│   │   └── init.py
│   └── models.py (model Cheese, links to eggs.Store and spam.Employee)
├── djtest
│   ├── basemodel.py
│   ├── init.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── eggs
│   ├── init.py
│   ├── migrations
│   │   └── init.py
│   └── models.py (model Store, links to spam.Employee)
├── manage.py
└── spam

├── init.py
├── migrations
│   └── init.py
└── models.py (model Employee, links to itself and eggs.Store; model Eggs, links to spam.Employee and cheese.Cheese)

Issue the following commands for the attached project:

$ python manage.py makemigrations
$ manage squashmigrations cheese 0003
$ manage squashmigrations eggs 0002

The following is raised:

django.db.migrations.graph.CircularDependencyError: [('spam', '0001_initial'), ('cheese', '0001_squashed_0003_cheese_updated_by'), ('spam', '0001_initial')]

Attachments (1)

djtest.zip (5.0 KB) - added by Richard Eames 2 years ago.
Test project

Download all attachments as: .zip

Change History (11)

Changed 2 years ago by Richard Eames

Attachment: djtest.zip added

Test project

comment:1 Changed 2 years ago by Simon Charette

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Thanks for the detailed report. Just to make sure, did you reproduce against 1.7-rc-2 or 1.7-rc-3?

comment:2 Changed 2 years ago by Richard Eames

Version: 1.7-rc-21.7-rc-3

It was 1.7-rc-3, The option wasn't available when I reported.

comment:3 Changed 2 years ago by Simon Charette

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Managed to reproduce.

comment:4 Changed 2 years ago by Andrew Godwin

Ah, yes, squashing migrations does occasionally result in circular dependencies and there's no way we can solve this in 1.7 (it requires some specialised coding we just don't have). I'll add a note to the docs about this and bump it down from Release Blocker to a more general issue we need to solve next release.

comment:5 Changed 2 years ago by Andrew Godwin <andrew@…>

In 459cfb523d8812081a623b29d0b8ab13bf87190a:

Update squashmigration docs to also mention circ dep errs (refs #23337)

comment:6 Changed 2 years ago by Andrew Godwin

Severity: Release blockerNormal
Version: 1.7-rc-3master

comment:7 Changed 2 years ago by Andrew Godwin <andrew@…>

In fbe45076234b1509a574a78a0f2b2dda602836db:

[1.7.x] Update squashmigration docs to also mention circ dep errs (refs #23337)

comment:8 Changed 2 years ago by Markus Holtermann

Cc: info+coding@… added

comment:9 Changed 22 months ago by Ian Foote

Cc: python@… added

comment:10 Changed 8 months ago by Joey Wilhelm

Cc: tarkatronic@… added
Note: See TracTickets for help on using tickets.
Back to Top