Skip to content

Commit

Permalink
Merge pull request #635 from aiarena/chore/improve-perf-on-news-and-m…
Browse files Browse the repository at this point in the history
…atch-participations

Improve selection performance on news and match participations
  • Loading branch information
lladdy authored Oct 18, 2023
2 parents 450c771 + 87e307a commit 714e4e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions aiarena/core/migrations/0071_auto_20231017_0957.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.16 on 2023-10-17 09:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0070_competition_indepth_bot_statistics_enabled'),
]

operations = [
migrations.AlterField(
model_name='matchparticipation',
name='participant_number',
field=models.PositiveSmallIntegerField(db_index=True),
),
migrations.AlterField(
model_name='news',
name='created',
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
]
2 changes: 1 addition & 1 deletion aiarena/core/models/match_participation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MatchParticipation(models.Model, LockableModelMixin):

)
match = models.ForeignKey(Match, on_delete=models.CASCADE)
participant_number = models.PositiveSmallIntegerField()
participant_number = models.PositiveSmallIntegerField(db_index=True)
bot = models.ForeignKey(Bot, on_delete=models.PROTECT)
starting_elo = models.SmallIntegerField(null=True)
"""The bot's ELO at the time the match started
Expand Down
2 changes: 1 addition & 1 deletion aiarena/core/models/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class News(models.Model):
created = models.DateTimeField(auto_now_add=True)
created = models.DateTimeField(auto_now_add=True, db_index=True)
title = models.TextField(max_length=40, blank=True, null=True)
text = models.TextField(max_length=500, blank=False, null=False)
yt_link = models.URLField(blank=True, null=True)
Expand Down

0 comments on commit 714e4e7

Please sign in to comment.