From a80523b936fc113a28520abe404433dedccea41a Mon Sep 17 00:00:00 2001 From: Daniel Wong Date: Wed, 14 May 2025 16:56:54 -0600 Subject: [PATCH] fix: refactor index_together to indexes for Django 5.2 support --- ...tended_student_module_student_module_idx.py | 18 ++++++++++++++++++ .../coursewarehistoryextended/models.py | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 lms/djangoapps/coursewarehistoryextended/migrations/0003_rename_studentmodulehistoryextended_student_module_student_module_idx.py diff --git a/lms/djangoapps/coursewarehistoryextended/migrations/0003_rename_studentmodulehistoryextended_student_module_student_module_idx.py b/lms/djangoapps/coursewarehistoryextended/migrations/0003_rename_studentmodulehistoryextended_student_module_student_module_idx.py new file mode 100644 index 0000000000..c39e2410b5 --- /dev/null +++ b/lms/djangoapps/coursewarehistoryextended/migrations/0003_rename_studentmodulehistoryextended_student_module_student_module_idx.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.20 on 2025-05-15 03:30 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('coursewarehistoryextended', '0002_force_studentmodule_index'), + ] + + operations = [ + migrations.RenameIndex( + model_name='studentmodulehistoryextended', + new_name='student_module_idx', + old_fields=('student_module',), + ), + ] diff --git a/lms/djangoapps/coursewarehistoryextended/models.py b/lms/djangoapps/coursewarehistoryextended/models.py index 37de4a93ab..d9e2d54cca 100644 --- a/lms/djangoapps/coursewarehistoryextended/models.py +++ b/lms/djangoapps/coursewarehistoryextended/models.py @@ -33,7 +33,12 @@ class StudentModuleHistoryExtended(BaseStudentModuleHistory): class Meta: app_label = 'coursewarehistoryextended' get_latest_by = "created" - index_together = ['student_module'] + indexes = [ + models.Index( + fields=['student_module'], + name="student_module_idx" + ), + ] id = UnsignedBigIntAutoField(primary_key=True) # pylint: disable=invalid-name