mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
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:
committed by
Tim Abbott
parent
aabab08eba
commit
e3d1ff1cc2
@@ -0,0 +1,21 @@
|
||||
from django.contrib.postgres.operations import AddIndexConcurrently
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
("confirmation", "0013_alter_realmcreationkey_id"),
|
||||
("contenttypes", "0002_remove_content_type_name"),
|
||||
("zerver", "0552_remove_realm_private_message_policy"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
AddIndexConcurrently(
|
||||
model_name="confirmation",
|
||||
index=models.Index(
|
||||
fields=["content_type", "object_id"], name="confirmatio_content_80155a_idx"
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user