Replace index_together with indexes

index_together is deprecated in Django 4.2.
This commit is contained in:
Ilya 2025-10-21 18:22:58 +02:00
parent 36a782945b
commit 89c0535cab
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,15 @@
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("auditlog", "0018_logentry_remote_port"),
]
operations = [
migrations.RenameIndex(
model_name="logentry",
new_name="auditlog_timestamp_id_idx",
old_fields=("timestamp", "id"),
),
]

View file

@ -377,7 +377,9 @@ class LogEntry(models.Model):
ordering = ["-timestamp"]
verbose_name = _("log entry")
verbose_name_plural = _("log entries")
index_together = ("timestamp", "id")
indexes = [
models.Index(fields=["timestamp", "id"], name="auditlog_timestamp_id_idx"),
]
def __str__(self):
if self.action == self.Action.CREATE: