Add db index to log entry timestamp

Makes a small but observable performance improvement to the audit log report
pull/7535/head
Matt Westcott 2021-07-20 13:18:24 +01:00 zatwierdzone przez Matt Westcott
rodzic b020a6e785
commit 1ab7ef91df
2 zmienionych plików z 24 dodań i 1 usunięć

Wyświetl plik

@ -0,0 +1,23 @@
# Generated by Django 3.2.5 on 2021-07-20 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0063_modellogentry'),
]
operations = [
migrations.AlterField(
model_name='modellogentry',
name='timestamp',
field=models.DateTimeField(db_index=True, verbose_name='timestamp (UTC)'),
),
migrations.AlterField(
model_name='pagelogentry',
name='timestamp',
field=models.DateTimeField(db_index=True, verbose_name='timestamp (UTC)'),
),
]

Wyświetl plik

@ -89,7 +89,7 @@ class BaseLogEntry(models.Model):
action = models.CharField(max_length=255, blank=True, db_index=True)
data_json = models.TextField(blank=True)
timestamp = models.DateTimeField(verbose_name=_('timestamp (UTC)'))
timestamp = models.DateTimeField(verbose_name=_('timestamp (UTC)'), db_index=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL,