From 20b11359e07b904d7d10e38be08ff8b8ce7f498c Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 15 Mar 2023 17:55:23 -0400 Subject: [PATCH] Add index to rank field --- .../migrations/0034_alter_chartrecord_rank.py | 18 ++++++++++++++++++ vrobbler/apps/scrobbles/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 vrobbler/apps/scrobbles/migrations/0034_alter_chartrecord_rank.py diff --git a/vrobbler/apps/scrobbles/migrations/0034_alter_chartrecord_rank.py b/vrobbler/apps/scrobbles/migrations/0034_alter_chartrecord_rank.py new file mode 100644 index 0000000..1b25d87 --- /dev/null +++ b/vrobbler/apps/scrobbles/migrations/0034_alter_chartrecord_rank.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.5 on 2023-03-15 21:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("scrobbles", "0033_genre_objectwithgenres"), + ] + + operations = [ + migrations.AlterField( + model_name="chartrecord", + name="rank", + field=models.IntegerField(db_index=True), + ), + ] diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index cee385b..8dda98a 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -258,7 +258,7 @@ class ChartRecord(TimeStampedModel): """ user = models.ForeignKey(User, on_delete=models.DO_NOTHING, **BNULL) - rank = models.IntegerField() + rank = models.IntegerField(db_index=True) count = models.IntegerField(default=0) year = models.IntegerField(default=timezone.now().year) month = models.IntegerField(**BNULL)