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 Initial Version

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

I have a bunch of Models of the form

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

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 (0)

Note: See TracTickets for help on using tickets.
Back to Top