From 8d549df088da88f0f853d6c6d5e4a6af996967de Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 9 May 2016 19:54:32 -0400 Subject: [PATCH] Index the is_stub and is_deleted document boolean fields. --- .../migrations/0034_auto_20160509_2321.py | 24 +++++++++++++++++++ mayan/apps/documents/models.py | 8 ++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 mayan/apps/documents/migrations/0034_auto_20160509_2321.py diff --git a/mayan/apps/documents/migrations/0034_auto_20160509_2321.py b/mayan/apps/documents/migrations/0034_auto_20160509_2321.py new file mode 100644 index 0000000000..bdcae825f8 --- /dev/null +++ b/mayan/apps/documents/migrations/0034_auto_20160509_2321.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('documents', '0033_auto_20160325_0052'), + ] + + operations = [ + migrations.AlterField( + model_name='document', + name='in_trash', + field=models.BooleanField(default=False, verbose_name='In trash?', db_index=True, editable=False), + ), + migrations.AlterField( + model_name='document', + name='is_stub', + field=models.BooleanField(default=True, editable=False, help_text='A document stub is a document with an entry on the database but no file uploaded. This could be an interrupted upload or a deferred upload via the API.', verbose_name='Is stub?', db_index=True), + ), + ] diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index bf41bc742e..c866e3491e 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -169,7 +169,8 @@ class Document(models.Model): verbose_name=_('Language') ) in_trash = models.BooleanField( - default=False, editable=False, verbose_name=_('In trash?') + db_index=True, default=False, editable=False, + verbose_name=_('In trash?') ) # TODO: set editable to False deleted_date_time = models.DateTimeField( @@ -177,10 +178,11 @@ class Document(models.Model): verbose_name=_('Date and time trashed') ) is_stub = models.BooleanField( - default=True, editable=False, help_text=_( + db_index=True, default=True, editable=False, help_text=_( 'A document stub is a document with an entry on the database but ' 'no file uploaded. This could be an interrupted upload or a ' - 'deferred upload via the API.'), verbose_name=_('Is stub?') + 'deferred upload via the API.' + ), verbose_name=_('Is stub?') ) objects = DocumentManager()