From b7835d4e9e8701d9953e784a7705de4f6a4ae948 Mon Sep 17 00:00:00 2001 From: Eric Holscher <25510+ericholscher@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:21:05 -0800 Subject: [PATCH] Add date version index on build (#11612) Fixes https://github.com/readthedocs/ext-theme/issues/463 --- .../migrations/0059_add_version_date_index.py | 20 +++++++++++++++++++ readthedocs/builds/models.py | 1 + 2 files changed, 21 insertions(+) create mode 100644 readthedocs/builds/migrations/0059_add_version_date_index.py diff --git a/readthedocs/builds/migrations/0059_add_version_date_index.py b/readthedocs/builds/migrations/0059_add_version_date_index.py new file mode 100644 index 00000000000..180adae1729 --- /dev/null +++ b/readthedocs/builds/migrations/0059_add_version_date_index.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.16 on 2024-09-23 18:18 + +from django.db import migrations, models +from django_safemigrate import Safe + + +class Migration(migrations.Migration): + safe = Safe.always + dependencies = [ + ("builds", "0058_alter_version_created_alter_version_modified"), + ] + + operations = [ + migrations.AddIndex( + model_name="build", + index=models.Index( + fields=["version", "date"], name="builds_buil_version_259bbf_idx" + ), + ), + ] diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index b11ea8ee406..25940a8bb99 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -846,6 +846,7 @@ class Meta: ] indexes = [ models.Index(fields=["project", "date"]), + models.Index(fields=["version", "date"]), ] def __init__(self, *args, **kwargs):