Skip to content

Commit 0fe5430

Browse files
committed
models: Index project patch filtering and name ordering
Cover project/submitter lookups and project/name ordering and substring-search counts. Signed-off-by: Stephen Finucane <stephen@that.guru> Assisted-by: OpenAI gpt-6.1-sol (via pi)
1 parent 08309ff commit 0fe5430

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
('patchwork', '0051_patch_api_indexes'),
9+
]
10+
11+
operations = [
12+
migrations.AddIndex(
13+
model_name='patch',
14+
index=models.Index(
15+
fields=['project', 'submitter', 'id'],
16+
name='patch_project_submitter_idx',
17+
),
18+
),
19+
migrations.AddIndex(
20+
model_name='patch',
21+
index=models.Index(
22+
fields=['project', 'name', 'id'],
23+
name='patch_project_name_idx',
24+
),
25+
),
26+
]

‎patchwork/models.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,14 @@ class Meta:
762762
models.Index(
763763
fields=['project', 'date', 'id'], name='patch_project_date_idx'
764764
),
765+
models.Index(
766+
fields=['project', 'submitter', 'id'],
767+
name='patch_project_submitter_idx',
768+
),
769+
# Also cover substring-search counts without fetching patch rows.
770+
models.Index(
771+
fields=['project', 'name', 'id'], name='patch_project_name_idx'
772+
),
765773
]
766774

767775

0 commit comments

Comments
 (0)