Opened 2 years ago

Last modified 2 years ago

#33947 closed Uncategorized

Adding db_index to a field inherited from an Abstract class does not propagate the change to the models subclassing it — at Version 1

Reported by: awiebe Owned by: nobody
Component: Database layer (models, ORM) Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by awiebe)

I have a bunch of Models of the form

  class AbstractOwnershipModel(models.Model):
     owner_user= models.ForeignKey('auth.User')
     class Meta:
      abstract = True
 class AnOwnedModel(AbstractOwnershipModel):
   #...

Which I tried to change to

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.

Change History (1)

comment:1 by awiebe, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top