#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:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Alex Morega):

 * status:  new => closed
 * resolution:   => invalid


Comment:

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

 That's because the index is
 
[https://docs.djangoproject.com/en/4.1/ref/models/fields/#django.db.models.ForeignKey
 already created by default]:

 >A database index is automatically created on the `ForeignKey`. You can
 disable this by setting `db_index` to `False`. You may want to avoid the
 overhead of an index if you are creating a foreign key for consistency
 rather than joins, or if you will be creating an alternative index like a
 partial or multiple column index.

 You can check by connecting to the database using `./manage.py dbshell`
 and looking at the database schema.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33947#comment:2>
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/01070182c92d83e3-6563c2bb-0046-4b28-b3f4-f97d474d119a-000000%40eu-central-1.amazonses.com.

Reply via email to