From c8f5451ea4e2055a5b028722798ef0ff39a5db28 Mon Sep 17 00:00:00 2001 From: Benjamin Graillot Date: Wed, 11 Mar 2020 13:46:47 +0100 Subject: [PATCH] Added indexes for Transaction, Alias and Profile --- apps/member/models.py | 1 + apps/note/models/notes.py | 4 ++++ apps/note/models/transactions.py | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/apps/member/models.py b/apps/member/models.py index 50b0bea1..b596357f 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -46,6 +46,7 @@ class Profile(models.Model): class Meta: verbose_name = _('user profile') verbose_name_plural = _('user profile') + indexes = [ models.Index(fields=['user']) ] def get_absolute_url(self): return reverse('user_detail', args=(self.pk,)) diff --git a/apps/note/models/notes.py b/apps/note/models/notes.py index 74cda3ea..70810ad8 100644 --- a/apps/note/models/notes.py +++ b/apps/note/models/notes.py @@ -209,6 +209,10 @@ class Alias(models.Model): class Meta: verbose_name = _("alias") verbose_name_plural = _("aliases") + indexes = [ + models.Index(fields=['name']), + models.Index(fields=['normalized_name']), + ] def __str__(self): return self.name diff --git a/apps/note/models/transactions.py b/apps/note/models/transactions.py index 3bb7ca76..809e7c44 100644 --- a/apps/note/models/transactions.py +++ b/apps/note/models/transactions.py @@ -119,6 +119,11 @@ class Transaction(PolymorphicModel): class Meta: verbose_name = _("transaction") verbose_name_plural = _("transactions") + indexes = [ + models.Index(fields=['created_at']), + models.Index(fields=['source']), + models.Index(fields=['destination']), + ] def save(self, *args, **kwargs): """