diff --git a/issues/migrations/0007_alter_turningpoint_options.py b/issues/migrations/0007_alter_turningpoint_options.py new file mode 100644 index 0000000..f31956d --- /dev/null +++ b/issues/migrations/0007_alter_turningpoint_options.py @@ -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"]}, + ), + ] diff --git a/issues/models.py b/issues/models.py index 5d2de05..df88983 100644 --- a/issues/models.py +++ b/issues/models.py @@ -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"]), ]