Skip to content

Commit

Permalink
Add indexes to StandingFleetVoiceRecord for SQL querying (minmatarfle…
Browse files Browse the repository at this point in the history
  • Loading branch information
bearthatcares authored Dec 13, 2024
1 parent 4762e76 commit 289763e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.1.2 on 2024-12-13 15:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("standingfleet", "0001_initial"),
]

operations = [
migrations.AddIndex(
model_name="standingfleetvoicerecord",
index=models.Index(fields=["created_on"], name="created_on_idx"),
),
migrations.AddIndex(
model_name="standingfleetvoicerecord",
index=models.Index(fields=["username"], name="username_idx"),
),
]
8 changes: 8 additions & 0 deletions backend/standingfleet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ class StandingFleetVoiceRecord(models.Model):
created_on = models.DateTimeField(auto_now_add=True)
username = models.CharField(max_length=255)
minutes = models.IntegerField()

class Meta:
indexes = [
# Index on 'created_on' for queries filtering by creation date
models.Index(fields=["created_on"], name="created_on_idx"),
# Index on 'username' for queries filtering by username
models.Index(fields=["username"], name="username_idx"),
]

0 comments on commit 289763e

Please sign in to comment.