models: Enforce an ordering to on audit logs to solve a flaky test.

Multiple events may be created with the same timestamp; we add a
default ordering by "id" such that these have a consistent ordering in
tests (to solve for flaky tests), as well as in the internal API.
This commit is contained in:
Alex Vandiver 2024-06-25 21:34:44 +00:00 committed by Tim Abbott
parent 9bc1eb4bb9
commit 872e2ad2cd

View File

@ -226,6 +226,7 @@ class RealmAuditLog(AbstractRealmAuditLog):
event_last_message_id = models.IntegerField(null=True)
class Meta:
ordering = ["id"]
indexes = [
models.Index(
name="zerver_realmauditlog_realm__event_type__event_time",