Skip to content

Commit bd0d6ae

Browse files
committed
models: Index project series ordering
Support project-scoped name and date ordering without sorting all series. Signed-off-by: Stephen Finucane <stephen@that.guru> Assisted-by: OpenAI gpt-6.1-sol (via pi)
1 parent 0fe5430 commit bd0d6ae

2 files changed

Lines changed: 36 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', '0052_patch_filter_indexes'),
9+
]
10+
11+
operations = [
12+
migrations.AddIndex(
13+
model_name='series',
14+
index=models.Index(
15+
fields=['project', 'date', 'id'],
16+
name='series_project_date_idx',
17+
),
18+
),
19+
migrations.AddIndex(
20+
model_name='series',
21+
index=models.Index(
22+
fields=['project', 'name', 'id'],
23+
name='series_project_name_idx',
24+
),
25+
),
26+
]

‎patchwork/models.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,16 @@ def __str__(self):
10211021

10221022
class Meta:
10231023
verbose_name_plural = 'Series'
1024+
indexes = [
1025+
models.Index(
1026+
fields=['project', 'date', 'id'],
1027+
name='series_project_date_idx',
1028+
),
1029+
models.Index(
1030+
fields=['project', 'name', 'id'],
1031+
name='series_project_name_idx',
1032+
),
1033+
]
10241034

10251035

10261036
class SeriesReference(models.Model):

0 commit comments

Comments
 (0)