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..97ee3e3c 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):