From: Stephen Finucane Date: Wed, 24 Jan 2024 11:09:46 +0000 (+0000) Subject: models: Add covering index for Patch.hash X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=801e5bd8bbb78e8459e53dcd5a0dc8eb17e92a48;p=thirdparty%2Fpatchwork.git models: Add covering index for Patch.hash Signed-off-by: Stephen Finucane Closes: #579 Cc: Mauro Carvalho Chehab --- diff --git a/patchwork/migrations/0047_add_database_indexes.py b/patchwork/migrations/0047_add_database_indexes.py new file mode 100644 index 00000000..42c11997 --- /dev/null +++ b/patchwork/migrations/0047_add_database_indexes.py @@ -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 + ), + ), + ] diff --git a/patchwork/models.py b/patchwork/models.py index 4e5afc4b..a05db7f9 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -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