Correctly order Turningpoints (as per comment)

This commit is contained in:
Klaas van Schelven
2024-12-16 22:04:03 +01:00
parent 2739422968
commit 6497f482ae
2 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
# Generated by Django 4.2.16 on 2024-12-16 21:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("issues", "0006_issue_next_unmute_check"),
]
operations = [
migrations.AlterModelOptions(
name="turningpoint",
options={"ordering": ["-timestamp", "-id"]},
),
]

View File

@@ -407,7 +407,9 @@ class TurningPoint(models.Model):
comment = models.TextField(blank=True, null=False, default="")
class Meta:
ordering = ["-timestamp"]
# by ordering on "-id" we order things that happen in a single ingestion in the order in which they happened.
# (in particular: NEXT_MATERIALIZED followed by REGRESSED is a common pattern)
ordering = ["-timestamp", "-id"]
indexes = [
models.Index(fields=["timestamp"]),
]