#26488: migrate crashes when renaming a multi-table inheritance base model
-------------------------------------+-------------------------------------
     Reporter:  Christopher          |                    Owner:  nobody
  Neugebauer                         |
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.9
     Severity:  Normal               |               Resolution:
     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 Christopher Neugebauer):

 So the previous example is a bit evil. Here's a reduced example that
 *works* in Django 1.11:

 **Step 0**
 {{{
     class BaseModel(models.Model):
         pass


     class SubModel(BaseModel):
         basemodel_ptr = models.OneToOneField(BaseModel, null=True)
 }}}
 Run `makemigrations`

 **Step 1**
 {{{
     class BaseModel(models.Model):
         pass


     class SubModel(BaseModel):
         pass
 }}}
 Run `makemigrations`


 **Step 2**
 {{{
     class RenamedBaseModel(models.Model):
         pass


     class SubModel(RenamedBaseModel):
         pass

 }}}
 Run `makemigrations`


 If you start with Step 0, you can successfully `migrate` at the end of
 step 2.
 If you start with Step 1, `migrate` breaks, but with a new error:

 `django.core.exceptions.FieldError: Auto-generated field 'basemodel_ptr'
 in class 'SubModel' for parent_link to base class 'BaseModel' clashes with
 declared field of the same name.`

-- 
Ticket URL: <https://code.djangoproject.com/ticket/26488#comment:9>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.f642082509230ce93487fb1aba821b59%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to