diff --git a/lms/djangoapps/grades/migrations/0021_rename_persistentcoursegrade_passed_timestamp_course_id_passed_timestamp_course_id_idx_and_more.py b/lms/djangoapps/grades/migrations/0021_rename_persistentcoursegrade_passed_timestamp_course_id_passed_timestamp_course_id_idx_and_more.py new file mode 100644 index 000000000000..c75dffc063eb --- /dev/null +++ b/lms/djangoapps/grades/migrations/0021_rename_persistentcoursegrade_passed_timestamp_course_id_passed_timestamp_course_id_idx_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.20 on 2025-05-12 13:39 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('grades', '0020_alter_historicalpersistentsubsectiongradeoverride_options'), + ] + + operations = [ + migrations.RenameIndex( + model_name='persistentcoursegrade', + new_name='passed_timestamp_course_id_idx', + old_fields=('passed_timestamp', 'course_id'), + ), + migrations.RenameIndex( + model_name='persistentcoursegrade', + new_name='modified_course_id_idx', + old_fields=('modified', 'course_id'), + ), + ] diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index 3d1facfdb0ad..f6266b9f828b 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -569,9 +569,9 @@ class Meta: unique_together = [ ('course_id', 'user_id'), ] - index_together = [ - ('passed_timestamp', 'course_id'), - ('modified', 'course_id') + indexes = [ + models.Index(fields=['passed_timestamp', 'course_id'], name="passed_timestamp_course_id_idx"), + models.Index(fields=['modified', 'course_id'], name="modified_course_id_idx") ] # primary key will need to be large for this table