Despite db_index=True, Django didn't generate an index

student_module_id is the primary way into this table, not having an
index is disastrous with real data.
This commit is contained in:
Kevin Falcone
2016-03-03 15:27:21 -05:00
parent fd4164de1d
commit 304fb68076
2 changed files with 19 additions and 0 deletions

View File

@@ -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',)]),
),
]

View File

@@ -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