#31837: Possible manager migration bug
--------------------------------+--------------------------------------
     Reporter:  Gordon Wrigley  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  closed
    Component:  Migrations      |                  Version:  3.0
     Severity:  Normal          |               Resolution:  invalid
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------

Comment (by Gordon Wrigley):

 Well:
 1: Both managers are declared in exactly the same way so why is one in and
 one out?
 2: They are both actually instances of the Django base manager so they
 have the same setting for use_in_migrations (I presume True)
 3: If you swap the order of the manager declarations around in the source
 code it no longer generates any migration
 4: If you leave the order as is in the linked commit but additionally
 redeclare the objects manager in the concrete model classes it again
 decides no migration is needed

 If this example seems a lil simplistic that's because I was trying to get
 a minimal reproduction, here's one that is structurally equivalent to what
 I actually have:
 https://github.com/tolomea/django-
 tutorial/commit/f247b6ddc5b2b689ec7ec0ede7cb0bc28c99db0c
 Where everything prefixed lib is in a 3rd party library.

 In there you can see that overriding objects on the concrete model causes
 both to be added to the migration.
 Switching the order of the managers around also leads to a migration
 adding both managers to both concrete models.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31837#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.e9055a4ad26371f70f0c31fbd72993a4%40djangoproject.com.

Reply via email to