#33947: Adding db_index to a field inherited from an Abstract class does not
propagate the change to the models subclassing it
-------------------------------------+-------------------------------------
     Reporter:  awiebe               |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by awiebe:

Old description:

> I have a bunch of Models of the form
> {{{
> #!div style="font-size: 80%"
>   {{{#!python
>   class AbstractOwnershipModel(models.Model):
>      owner_user= models.ForeignKey('auth.User')
>      class Meta:
>       abstract = True
>   }}}
> }}}
>
> Which I tried to change to
> {{{
> #!div style="font-size: 80%"
>   {{{#!python
>   class AbstractOwnershipModel(models.Model):
>      owner_user= models.ForeignKey('auth.User',db_index=True)
>      class Meta:
>       abstract = True
>   }}}
> }}}
>
> But makemigrations reports that there are no changes even though I would
> expect a bunch of indexes to be created.

New description:

 I have a bunch of Models of the form
 {{{
 #!div style="font-size: 80%"
   {{{#!python
   class AbstractOwnershipModel(models.Model):
      owner_user= models.ForeignKey('auth.User')
      class Meta:
       abstract = True
  class AnOwnedModel(AbstractOwnershipModel):
    #...
   }}}
 }}}

 Which I tried to change to
 {{{
 #!div style="font-size: 80%"
   {{{#!python
   class AbstractOwnershipModel(models.Model):
      owner_user= models.ForeignKey('auth.User',db_index=True)
      class Meta:
       abstract = True
   }}}
 }}}

 But makemigrations reports that there are no changes even though I would
 expect a bunch of indexes to be created.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33947#comment:1>
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/01070182c7ba4c86-9fb8a2c6-292e-4fa6-8a9e-e8a3d4ce6a6f-000000%40eu-central-1.amazonses.com.

Reply via email to