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'