Skip to content

Commit

Permalink
models: Add covering index for Patch.hash
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Finucane <[email protected]>
Closes: #579
Cc: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
stephenfin committed Oct 31, 2024
1 parent c443cd9 commit 801e5bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions patchwork/migrations/0047_add_database_indexes.py
Original file line number Diff line number Diff line change
@@ -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
),
),
]
2 changes: 1 addition & 1 deletion patchwork/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 801e5bd

Please sign in to comment.