From 854990a85063f16717fc6ac41e6ac3bc34b30a35 Mon Sep 17 00:00:00 2001 From: joseph-sentry <136376984+joseph-sentry@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:41:15 -0500 Subject: [PATCH] add storage_path index on ReportSession (#483) --- ...9_reportsession_upload_storage_path_idx.py | 25 +++++++++++++++++++ shared/django_apps/reports/models.py | 4 +++ 2 files changed, 29 insertions(+) create mode 100644 shared/django_apps/reports/migrations/0039_reportsession_upload_storage_path_idx.py diff --git a/shared/django_apps/reports/migrations/0039_reportsession_upload_storage_path_idx.py b/shared/django_apps/reports/migrations/0039_reportsession_upload_storage_path_idx.py new file mode 100644 index 00000000..6e661b8a --- /dev/null +++ b/shared/django_apps/reports/migrations/0039_reportsession_upload_storage_path_idx.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.16 on 2025-01-28 15:28 + +from django.db import migrations, models + +""" +BEGIN; +-- +-- Create index upload_storage_path_idx on field(s) storage_path of model reportsession +-- +CREATE INDEX "upload_storage_path_idx" ON "reports_upload" ("storage_path"); +COMMIT; +""" + + +class Migration(migrations.Migration): + dependencies = [ + ("reports", "0038_remove_test_reports_test_repoid_name_testsuite_flags_hash"), + ] + + operations = [ + migrations.AddIndex( + model_name="reportsession", + index=models.Index(fields=["storage_path"], name="upload_storage_path_idx"), + ), + ] diff --git a/shared/django_apps/reports/models.py b/shared/django_apps/reports/models.py index d33f625a..fa564bda 100644 --- a/shared/django_apps/reports/models.py +++ b/shared/django_apps/reports/models.py @@ -202,6 +202,10 @@ class Meta: name="upload_report_type_idx", fields=["report_id", "upload_type"], ), + models.Index( + name="upload_storage_path_idx", + fields=["storage_path"], + ), ] @property