From 050876fe489a8f0125fbfbc74954ad4070ce963d Mon Sep 17 00:00:00 2001 From: Sanjin <102841251+duckduckgrayduck@users.noreply.github.com> Date: Tue, 22 Sep 2026 09:30:51 -0500 Subject: [PATCH 1/2] Use correct index --- ..._addonrun_addonrun_user_id_idx_and_more.py | 25 +++++++++++++++++++ documentcloud/addons/models.py | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 documentcloud/addons/migrations/0033_remove_addonrun_addonrun_user_id_idx_and_more.py diff --git a/documentcloud/addons/migrations/0033_remove_addonrun_addonrun_user_id_idx_and_more.py b/documentcloud/addons/migrations/0033_remove_addonrun_addonrun_user_id_idx_and_more.py new file mode 100644 index 00000000..37f47642 --- /dev/null +++ b/documentcloud/addons/migrations/0033_remove_addonrun_addonrun_user_id_idx_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 5.2.15 on 2026-09-22 14:28 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("addons", "0032_addonrun_addonrun_user_id_idx"), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.RemoveIndex( + model_name="addonrun", + name="addonrun_user_id_idx", + ), + migrations.AddIndex( + model_name="addonrun", + index=models.Index( + fields=["user", "-created_at"], name="addonrun_user_created_idx" + ), + ), + ] diff --git a/documentcloud/addons/models.py b/documentcloud/addons/models.py index 59b7db02..68888229 100644 --- a/documentcloud/addons/models.py +++ b/documentcloud/addons/models.py @@ -413,7 +413,11 @@ class AddOnRun(models.Model): class Meta: indexes = [ - models.Index(fields=["user", "-id"], name="addonrun_user_id_idx"), + # CursorPagination defaults to pk, but the AddOnRunViewSet actually overrides to + # use -created_at. + models.Index( + fields=["user", "-created_at"], name="addonrun_user_created_idx" + ), ] def __str__(self): From af7122009087c847a38413c1a81f83349a7eb4a7 Mon Sep 17 00:00:00 2001 From: Sanjin <102841251+duckduckgrayduck@users.noreply.github.com> Date: Tue, 22 Sep 2026 09:35:18 -0500 Subject: [PATCH 2/2] Format --- documentcloud/addons/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentcloud/addons/models.py b/documentcloud/addons/models.py index 68888229..97ee3e3c 100644 --- a/documentcloud/addons/models.py +++ b/documentcloud/addons/models.py @@ -413,8 +413,8 @@ class AddOnRun(models.Model): class Meta: indexes = [ - # CursorPagination defaults to pk, but the AddOnRunViewSet actually overrides to - # use -created_at. + # CursorPagination defaults to pk, but the AddOnRunViewSet + # actually overrides to use -created_at. models.Index( fields=["user", "-created_at"], name="addonrun_user_created_idx" ),