﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32393	Indexes of only the first abstract base class are included in the model	Dmitry Ulupov	nobody	"If model has multiple base abstract models, their {{{ Meta.indexes }}} declarations are treated differently.

Only indexes from the first class are taken into account.
Indexes of all other base classes are ignored.

Consider this code:

{{{
class ParentA(models.Model):
    field_a = models.CharField(max_length=10)

    class Meta:
        abstract = True


class ParentB(models.Model):
    field_b = models.CharField(max_length=10)

    class Meta:
        abstract = True
        indexes = [
            models.Index(
                fields=[""field_b""],
                name=""ix_%(app_label)s_%(class)s"",
            ),
        ]


class ChildOf_A_B(ParentA, ParentB):
    pass


class ChildOf_B_A(ParentB, ParentA):
    pass

}}}

makemigrations in this case produces this:

{{{

./manage.py makemigrations app

Migrations for 'app':
  project/app/migrations/0001_initial.py
    - Create model ChildOf_A_B
    - Create model ChildOf_B_A
    - Create index ix_app_childof_b_a on field(s) field_b of model childof_b_a

}}}

So index on ChildOf_B_A is created, but on ChildOf_A_B is not.
And only difference is the order of declaration of the base classes."	Bug	closed	Migrations	3.1	Normal	invalid			Unreviewed	0	0	0	0	0	0
