From: Jan Szejko Date: Mon, 26 Feb 2018 14:05:06 +0000 (+0100) Subject: add index on popularity count X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/03d4bd47acfcdc6444fdc689ceeb636c5a4e2cae add index on popularity count --- diff --git a/src/catalogue/migrations/0022_auto_20180226_1503.py b/src/catalogue/migrations/0022_auto_20180226_1503.py new file mode 100644 index 000000000..a673f42e3 --- /dev/null +++ b/src/catalogue/migrations/0022_auto_20180226_1503.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0021_auto_20171222_1404'), + ] + + operations = [ + migrations.AlterField( + model_name='bookpopularity', + name='count', + field=models.IntegerField(default=0, db_index=True), + ), + ] diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 0f664c42d..8b85ec718 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -715,4 +715,4 @@ add_file_fields() class BookPopularity(models.Model): book = models.OneToOneField(Book, related_name='popularity') - count = models.IntegerField(default=0) + count = models.IntegerField(default=0, db_index=True)