Migrations circular dependency on upgrade to Django 1.11

36 views
Skip to first unread message

Tom Evans

unread,
Dec 15, 2017, 6:38:49 AM12/15/17
to django...@googlegroups.com
Hi all

I'm updating a project from Django 1.8 to 1.11, however the migrations
which ran correctly under 1.8 now raise a CircularDependencyError for
(effortless_auth.0001_initial, app.0028_create_south_korea_data_set,
effortless_auth.0003_add_dev_group,
app.0027_create_effortless_verticals), which I'll summarise:

effortless_auth.0001_initial
Depends:
auth.__first__, places.__first__, auth.0006_require_contenttypes_0002
Adds:
AccountManager, DataSetType, PropValue, SpeedTestResult,
Vertical -> no FKs outside of app
GroupExtension -> (modified after creation to add fk to auth.Group)
PropDefinition -> fk to auth.Group
UserEvent -> fk to auth.User (settings.AUTH_USER_MODEL)
UserProp -> fk to auth.User (settings.AUTH_USER_MODEL)
Modifies:
GroupExtension -> add fk to auth.Group

app.0028_create_south_korea_data_set
Depends:
effortless_auth.003_add_dev_group
Runs:
Creates DataSetType instance

effortless_auth.0003_add_dev_group
Depends:
effortless_auth.0002_create_custom_content_group
Runs:
Creates and populates a Group and GroupExtension

app.0027_create_effortless_verticals
Depends:
effortless_auth.003_add_dev_group
Runs:
Creates 4 Vertical instances

I do not see what is circular from this, the graph should surely be:
auth.__first__
auth....
auth.0006
effortless_auth.0001
..
effortless_auth.0003
...
app.0027
app.0028

Why does this now confuse Django? I have a feeling this is due to
swappable models for auth (which we do not use, this project was
started with AUTH_USER_MODEL unset, but another project which re-uses
some of our libraries does do).

I can share more of the migrations, there is some additional
complexity I have skipped over because effortless_auth used to be part
of "app" and 'app' has had migrations squashed in the past, so many of
these migrations have "replaces" attributes also.

Cheers

Tom

Tom Evans

unread,
Dec 15, 2017, 11:31:56 AM12/15/17
to django...@googlegroups.com
After more investigating, it seems that the problem was due to the
squashed migrations and the migrations they replaced both being
present. After removing all migrations (from our apps) listed in
"replaces" and fixing up the dependencies to not point at the old
squashed migration (which I guess was the real problem?) I now get no
circular dependencies (woo!)

Unfortunately they still don't run, so that's the next task :(

Cheers

Tom
Reply all
Reply to author
Forward
0 new messages