diff --git a/lms/djangoapps/coursewarehistoryextended/migrations/0002_force_studentmodule_index.py b/lms/djangoapps/coursewarehistoryextended/migrations/0002_force_studentmodule_index.py new file mode 100644 index 0000000000..2257c8eab0 --- /dev/null +++ b/lms/djangoapps/coursewarehistoryextended/migrations/0002_force_studentmodule_index.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('coursewarehistoryextended', '0001_initial'), + ] + + operations = [ + migrations.AlterIndexTogether( + name='studentmodulehistoryextended', + index_together=set([('student_module',)]), + ), + ] diff --git a/lms/djangoapps/coursewarehistoryextended/models.py b/lms/djangoapps/coursewarehistoryextended/models.py index 8c3630b0e3..dc99c1f533 100644 --- a/lms/djangoapps/coursewarehistoryextended/models.py +++ b/lms/djangoapps/coursewarehistoryextended/models.py @@ -31,6 +31,7 @@ class StudentModuleHistoryExtended(BaseStudentModuleHistory): class Meta(object): app_label = 'coursewarehistoryextended' get_latest_by = "created" + index_together = ['student_module'] id = UnsignedBigIntAutoField(primary_key=True) # pylint: disable=invalid-name