From 29e32ddf155475a022843f9dd8eb9571baf6d915 Mon Sep 17 00:00:00 2001 From: NitroBit Date: Fri, 27 Sep 2024 12:33:13 +0200 Subject: [PATCH] index_together is deprecated: https://docs.djangoproject.com/en/5.1/releases/4.2/#index-together-option-is-deprecated-in-favor-of-indexes --- django_cron/models.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/django_cron/models.py b/django_cron/models.py index c109e09..73c7306 100644 --- a/django_cron/models.py +++ b/django_cron/models.py @@ -24,14 +24,10 @@ def __str__(self): return "%s (%s)" % (self.code, "Success" if self.is_success else "Fail") class Meta: - index_together = [ - ('code', 'is_success', 'ran_at_time'), - ('code', 'start_time', 'ran_at_time'), - ( - 'code', - 'start_time', - ), # useful when finding latest run (order by start_time) of cron - ] + indexes = [models.Index(fields=["code", "is_success", "ran_at_time"]), + models.Index(fields=["code", "start_time", "ran_at_time"]), + models.Index(fields=["code", "start_time"])] + # useful when finding latest run (order by start_time) of cron app_label = 'django_cron'