Opened 5 years ago

Closed 5 years ago

#23392 closed Bug (invalid)

Django runs all migration operations but only marks 0001 as completed

Reported by: Owais Lone Owned by: nobody
Component: Migrations Version: 1.7-rc-3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I've patched the contrib auth app to add some fields to auth.Group table. I've created a custom migration module for auth app which has 2 migrations,

0001: The migration supplied by contrib.auth as is.
0002: Migration that adds my custom fields to auth.Group table. ( looks like this:

The problem is that when I run the migrations for auth, django creates the final schema structure after running 0001 and as a result when django runs 0002, it complains about some fields already being present.

I'm patching the Group model like this:

This patch runs right before calls a command.

Change History (3)

comment:1 Changed 5 years ago by Owais Lone

Type: UncategorizedBug

comment:2 Changed 5 years ago by Collin Anderson

I don't think we support adding custom fields to the auth.Group model, but could it be that the signal is being run on the 0001 migration state, which makes django think that nothing's changed in 0002?

comment:3 Changed 5 years ago by Andrew Godwin

Resolution: invalid
Status: newclosed

We don't support monkeypatching models like this, so I'm going to have to close as INVALID. If you can reproduce it on a separate, fresh app we can reopen, but I suspect it's the very overloading of the model itself that's causing this.

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