Opened 10 months ago

Last modified 7 months ago

#23337 new Bug

CircularDependencyError when squashing migrations

Reported by: Naddiseo Owned by: nobody
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: info+coding@…, python@… 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 Naddiseo 10 months ago.
Test project

Download all attachments as: .zip

Change History (10)

Changed 10 months ago by Naddiseo

Test project

comment:1 Changed 10 months ago by charettes

  • 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 10 months ago by Naddiseo

  • Version changed from 1.7-rc-2 to 1.7-rc-3

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

comment:3 Changed 10 months ago by charettes

  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

Managed to reproduce.

comment:4 Changed 10 months ago by andrewgodwin

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 10 months ago by Andrew Godwin <andrew@…>

In 459cfb523d8812081a623b29d0b8ab13bf87190a:

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

comment:6 Changed 10 months ago by andrewgodwin

  • Severity changed from Release blocker to Normal
  • Version changed from 1.7-rc-3 to master

comment:7 Changed 10 months ago by Andrew Godwin <andrew@…>

In fbe45076234b1509a574a78a0f2b2dda602836db:

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

comment:8 Changed 10 months ago by Markush2010

  • Cc info+coding@… added

comment:9 Changed 7 months ago by Ian-Foote

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