#28438: Initial migration creates fields not listed in the migration if mixin 
class
changes
-------------------------------------+-------------------------------------
     Reporter:  Michal Dabski        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  migration,models,mixin,postgresql  |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Andrei Petre):

 Ah, I see, that mixin is made using an abstract model as I thought, cool,
 thanks.

 Ok, in that case maybe you could ask in `django-users` or ask in IRC for
 help? Some ideas of how to overcome that:
 - fix code as you suggested by using abstract and fake that 2nd migration
 to run, since that won't happen again for that same model (but other
 django code might rerun migrations, not sure? e.g. tests? but can be
 turned off) ; so next time you add another field to that mixin it won't
 change migration 0001 since you already ran it, so the newly generated
 migration to `AddField` will run fine. Might also help to squash all
 migrations so it'll generate proper new tables?

 - or, if possible, create a new model and extend from proper mixin and
 copy all records over? But this seems more complicated in an environment
 with lots of data, probably there's a better workaround like the one above
 if that works.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28438#comment:7>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.52d5522a19a081e139173cb5c0be4370%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to