Verified Commit 83e225a7 authored by Sli's avatar Sli

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

parent ca042fe7
Pipeline #2002 passed with stage
in 30 minutes and 45 seconds
# -*- 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"
),
),
]
......@@ -807,7 +807,7 @@ class SithFile(models.Model):
view_groups = models.ManyToManyField(
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)
size = models.IntegerField(_("size"), default=0)
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)
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()
class Meta:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment