#26488: migrate crashes when renaming a multi-table inheritance base model
-------------------------------------+-------------------------------------
     Reporter:  Christopher          |                    Owner:  nobody
  Neugebauer                         |
         Type:  Bug                  |                   Status:  closed
    Component:  Migrations           |                  Version:  dev
     Severity:  Normal               |               Resolution:  duplicate
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Olivier Dalang):

 Mariusz's workaround still worked here 7 years later, thanks !!

 However here I added another AlterModelBases afterwards to restore the
 initial state, otherwise I guess it could mess up with future migrations
 due to incorrect bases, esp. if using runpython.

 So just adding this here in case someone else (or my future self) stumbles
 on this workaround.

 {{{ #!python
    operations = [
         migrations.AlterModelBases('suba', (models.Model,)),
         migrations.RenameModel(
             old_name='Base',
             new_name='BrokenBase',
         ),
         migrations.RenameField(
             model_name='suba',
             old_name='base_ptr',
             new_name='brokenbase_ptr',
         ),
         # restore the original state
         migrations.AlterModelBases('suba', ('myapp.brokenbase',)),
     ]
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/26488#comment:19>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019ce67a31ca-16124ff3-3273-4888-934e-30904a214d26-000000%40eu-central-1.amazonses.com.

Reply via email to