Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

confirmation: Add an index on content_type, object_id.

Alex Vandiverfcb04598f0ea
diff --git a/confirmation/migrations/0014_confirmation_confirmatio_content_80155a_idx.py b/confirmation/migrations/0014_confirmation_confirmatio_content_80155a_idx.py
new file mode 100644
index 00000000000..a9e1c942025
--- /dev/null
+++ b/confirmation/migrations/0014_confirmation_confirmatio_content_80155a_idx.py
@@ -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"
+ ),
+ ),
+ ]
diff --git a/confirmation/models.py b/confirmation/models.py
index 8beea4b7e14..90fac69d669 100644
--- a/confirmation/models.py
+++ b/confirmation/models.py
@@ -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: