add index for models
This commit is contained in:
21
comment/migrations/0002_comment_comment_problem_time_idx.py
Normal file
21
comment/migrations/0002_comment_comment_problem_time_idx.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 6.0 on 2026-04-23 20:07
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('comment', '0001_initial'),
|
||||
('problem', '0007_problem_problem_visible_idx'),
|
||||
('submission', '0004_submission_problem_user_idx'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='comment',
|
||||
index=models.Index(fields=['problem', 'create_time'], name='comment_problem_time_idx'),
|
||||
),
|
||||
]
|
||||
@@ -40,5 +40,8 @@ class Comment(models.Model):
|
||||
class Meta:
|
||||
db_table = "comment"
|
||||
ordering = ("-create_time",)
|
||||
indexes = [
|
||||
models.Index(fields=["problem", "create_time"], name="comment_problem_time_idx"),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user