confirmation: Add an index on content_type, object_id.

This makes lookups of `.confirmation`, or joins through
`confirmation__` as we do in the `/json/invites`, actually fast.  See
https://code.djangoproject.com/ticket/23435

(cherry picked from commit fcb04598f0)
This commit is contained in:
Alex Vandiver
2024-07-10 17:21:36 +00:00
committed by Tim Abbott
parent aabab08eba
commit e3d1ff1cc2
2 changed files with 24 additions and 0 deletions

View File

@@ -231,6 +231,9 @@ class Confirmation(models.Model):
class Meta:
unique_together = ("type", "confirmation_key")
indexes = [
models.Index(fields=["content_type", "object_id"]),
]
@override
def __str__(self) -> str: