]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
models: Add covering index for Patch.hash
authorStephen Finucane <stephen@that.guru>
Wed, 24 Jan 2024 11:09:46 +0000 (11:09 +0000)
committerStephen Finucane <stephen@that.guru>
Thu, 31 Oct 2024 23:16:53 +0000 (23:16 +0000)
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #579
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
patchwork/migrations/0047_add_database_indexes.py [new file with mode: 0644]
patchwork/models.py

diff --git a/patchwork/migrations/0047_add_database_indexes.py b/patchwork/migrations/0047_add_database_indexes.py
new file mode 100644 (file)
index 0000000..42c1199
--- /dev/null
@@ -0,0 +1,18 @@
+import patchwork.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('patchwork', '0046_patch_comment_events'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='patch',
+            name='hash',
+            field=patchwork.fields.HashField(
+                blank=True, db_index=True, max_length=40, null=True
+            ),
+        ),
+    ]
index 4e5afc4bae6e8d844d1499256528561a15a8d736..a05db7f9c399ebb1435bf14415b56a9742b6a010 100644 (file)
@@ -501,7 +501,7 @@ class Patch(SubmissionMixin):
     )
     state = models.ForeignKey(State, null=True, on_delete=models.CASCADE)
     archived = models.BooleanField(default=False)
-    hash = HashField(null=True, blank=True)
+    hash = HashField(null=True, blank=True, db_index=True)
 
     # series metadata