Index last_seen
This commit is contained in:
parent
08b36ba69f
commit
45fd32c8ca
38
shynet/analytics/migrations/0004_auto_20210328_1514.py
Normal file
38
shynet/analytics/migrations/0004_auto_20210328_1514.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Generated by Django 3.1.7 on 2021-03-28 19:14
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('analytics', '0003_auto_20200502_1227'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='hit',
|
||||||
|
name='last_seen',
|
||||||
|
field=models.DateTimeField(default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='hit',
|
||||||
|
name='start_time',
|
||||||
|
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='session',
|
||||||
|
name='last_seen',
|
||||||
|
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='session',
|
||||||
|
name='start_time',
|
||||||
|
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='session',
|
||||||
|
index=models.Index(fields=['service', '-last_seen'], name='analytics_s_service_10bb96_idx'),
|
||||||
|
),
|
||||||
|
]
|
@ -22,7 +22,7 @@ class Session(models.Model):
|
|||||||
|
|
||||||
# Time
|
# Time
|
||||||
start_time = models.DateTimeField(default=timezone.now, db_index=True)
|
start_time = models.DateTimeField(default=timezone.now, db_index=True)
|
||||||
last_seen = models.DateTimeField(default=timezone.now)
|
last_seen = models.DateTimeField(default=timezone.now, db_index=True)
|
||||||
|
|
||||||
# Core request information
|
# Core request information
|
||||||
user_agent = models.TextField()
|
user_agent = models.TextField()
|
||||||
@ -53,6 +53,7 @@ class Session(models.Model):
|
|||||||
ordering = ["-start_time"]
|
ordering = ["-start_time"]
|
||||||
indexes = [
|
indexes = [
|
||||||
models.Index(fields=["service", "-start_time"]),
|
models.Index(fields=["service", "-start_time"]),
|
||||||
|
models.Index(fields=["service", "-last_seen"]),
|
||||||
models.Index(fields=["service", "identifier"]),
|
models.Index(fields=["service", "identifier"]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user