fix: refactor index_together to indexes for Django 5.2 support (IV) (#36716)
* fix: refactor index_together to indexes for Django 5.2 support * fix: fix quality issues
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 4.2.20 on 2025-05-14 05:53
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('grades', '0021_rename_persistentcoursegrade_passed_timestamp_course_id_passed_timestamp_course_id_idx_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameIndex(
|
||||
model_name='persistentsubsectiongrade',
|
||||
new_name='first_course_id_user_id_idx',
|
||||
old_fields=('first_attempted', 'course_id', 'user_id'),
|
||||
),
|
||||
migrations.RenameIndex(
|
||||
model_name='persistentsubsectiongrade',
|
||||
new_name='course_id_usage_key_idx',
|
||||
old_fields=('modified', 'course_id', 'usage_key'),
|
||||
),
|
||||
]
|
||||
@@ -315,9 +315,15 @@ class PersistentSubsectionGrade(TimeStampedModel):
|
||||
# in a course
|
||||
# (first_attempted, course_id, user_id): find all attempted subsections in a course for a user
|
||||
# (first_attempted, course_id): find all attempted subsections in a course for all users
|
||||
index_together = [
|
||||
('modified', 'course_id', 'usage_key'),
|
||||
('first_attempted', 'course_id', 'user_id')
|
||||
indexes = [
|
||||
models.Index(
|
||||
fields=['modified', 'course_id', 'usage_key'],
|
||||
name="course_id_usage_key_idx"
|
||||
),
|
||||
models.Index(
|
||||
fields=['first_attempted', 'course_id', 'user_id'],
|
||||
name="first_course_id_user_id_idx"
|
||||
),
|
||||
]
|
||||
|
||||
# primary key will need to be large for this table
|
||||
|
||||
Reference in New Issue
Block a user