Skip to content

Commit 801e5bd

Browse files
committed
models: Add covering index for Patch.hash
Signed-off-by: Stephen Finucane <[email protected]> Closes: #579 Cc: Mauro Carvalho Chehab <[email protected]>
1 parent c443cd9 commit 801e5bd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import patchwork.fields
2+
from django.db import migrations
3+
4+
5+
class Migration(migrations.Migration):
6+
dependencies = [
7+
('patchwork', '0046_patch_comment_events'),
8+
]
9+
10+
operations = [
11+
migrations.AlterField(
12+
model_name='patch',
13+
name='hash',
14+
field=patchwork.fields.HashField(
15+
blank=True, db_index=True, max_length=40, null=True
16+
),
17+
),
18+
]

patchwork/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ class Patch(SubmissionMixin):
501501
)
502502
state = models.ForeignKey(State, null=True, on_delete=models.CASCADE)
503503
archived = models.BooleanField(default=False)
504-
hash = HashField(null=True, blank=True)
504+
hash = HashField(null=True, blank=True, db_index=True)
505505

506506
# series metadata
507507

0 commit comments

Comments
 (0)