wip: add index of unaccented upper value of role.name
gitea/authentic/pipeline/head There was a failure building this commit Details

This commit is contained in:
Benjamin Dauvergne 2024-03-28 17:25:21 +01:00
parent 99b37f72a3
commit 722f0d9bd9
1 changed files with 4 additions and 0 deletions

View File

@ -27,6 +27,7 @@ from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.functions import Upper
from django.db.models.query import Prefetch, Q
from django.urls import reverse
from django.utils.text import slugify
@ -614,6 +615,9 @@ class Role(AbstractBase):
condition=models.Q(service__isnull=True, ou__isnull=True, admin_scope_ct__isnull=True),
),
]
indexes = [
models.Index(Upper(models.Func(models.F('name'), name='immutable_unaccent')), name='name_idx')
]
def natural_key(self):
return [