mirror of https://github.com/zulip/zulip.git
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
This commit is contained in:
parent
ab1e858eb9
commit
fcb04598f0
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue