Merge branch 'sas' into 'master'

core: add index on folder and sas properties of SithFile to speed up SAS

See merge request ae/Sith!231
This commit is contained in:
Antoine Bartuccio 2019-09-06 16:47:18 +02:00
commit eb9821ed36
2 changed files with 29 additions and 2 deletions

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-09-06 14:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("core", "0030_auto_20190704_1500")]
operations = [
migrations.AlterField(
model_name="sithfile",
name="is_folder",
field=models.BooleanField(
db_index=True, default=True, verbose_name="is folder"
),
),
migrations.AlterField(
model_name="sithfile",
name="is_in_sas",
field=models.BooleanField(
db_index=True, default=False, verbose_name="is in the SAS"
),
),
]

View File

@ -807,7 +807,7 @@ class SithFile(models.Model):
view_groups = models.ManyToManyField( view_groups = models.ManyToManyField(
Group, related_name="viewable_files", verbose_name=_("view group"), blank=True Group, related_name="viewable_files", verbose_name=_("view group"), blank=True
) )
is_folder = models.BooleanField(_("is folder"), default=True) is_folder = models.BooleanField(_("is folder"), default=True, db_index=True)
mime_type = models.CharField(_("mime type"), max_length=30) mime_type = models.CharField(_("mime type"), max_length=30)
size = models.IntegerField(_("size"), default=0) size = models.IntegerField(_("size"), default=0)
date = models.DateTimeField(_("date"), default=timezone.now) date = models.DateTimeField(_("date"), default=timezone.now)
@ -821,7 +821,7 @@ class SithFile(models.Model):
) )
asked_for_removal = models.BooleanField(_("asked for removal"), default=False) asked_for_removal = models.BooleanField(_("asked for removal"), default=False)
is_in_sas = models.BooleanField( is_in_sas = models.BooleanField(
_("is in the SAS"), default=False _("is in the SAS"), default=False, db_index=True
) # Allows to query this flag, updated at each call to save() ) # Allows to query this flag, updated at each call to save()
class Meta: class Meta: