VS Code version
None
OS
Ubuntu 24.04
Steps to reproduce
The suggest-indexes command seems to not recognize the following indexes:
- primary key, also filtering by
pk= and id= (in default model configuration, without any PK ovedrride) is not recognized as the same filter (pk is just an alias of whatever the primary key field is)
- fields with
db_index=True (including foreign-keys)
- unique fields
unique=True (because a unique constraint involves an index)
UniqueConstraints
Sample models.py (minimized)
class AModel(models.Model):
field = models.IntegerField()
class SimpleModel(models.Model):
unique_field = models.IntegerField(unique=True)
foreign_key = models.ForeignKey(AModel, db_index=True)
other_field = models.IntegerField()
class Meta:
constraints = [models.UniqueConstraint(fields=('foreign_key', 'other_field'), name='uc')]
VS Code version
None
OS
Ubuntu 24.04
Steps to reproduce
The
suggest-indexescommand seems to not recognize the following indexes:pk=andid=(in default model configuration, without any PK ovedrride) is not recognized as the same filter (pkis just an alias of whatever the primary key field is)db_index=True(including foreign-keys)unique=True(because a unique constraint involves an index)UniqueConstraintsSample models.py (minimized)