diff --git a/inyoka/portal/migrations/0036_user_upper_username_idx.py b/inyoka/portal/migrations/0036_user_upper_username_idx.py new file mode 100644 index 000000000..d24d3e286 --- /dev/null +++ b/inyoka/portal/migrations/0036_user_upper_username_idx.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.23 on 2024-02-05 21:55 + +from django.db import migrations, models +import django.db.models.functions.text + + +class Migration(migrations.Migration): + + dependencies = [ + ('portal', '0035_auto_20231127_0114'), + ] + + operations = [ + migrations.AddIndex( + model_name='user', + index=models.Index(django.db.models.functions.text.Upper('username'), name='upper_username_idx'), + ), + ] diff --git a/inyoka/portal/user.py b/inyoka/portal/user.py index bbaf642d3..036d38db3 100644 --- a/inyoka/portal/user.py +++ b/inyoka/portal/user.py @@ -24,6 +24,7 @@ from django.core.cache import cache from django.core.exceptions import ValidationError from django.db import models, transaction +from django.db.models.functions import Upper from django.dispatch import receiver from django.utils.html import escape from django.utils.translation import gettext as _ @@ -547,6 +548,9 @@ class Meta: permissions = ( ('subscribe_user', 'Can subscribe Users'), ) + indexes = [ + models.Index(Upper('username'), name='upper_username_idx'), + ] class UserPage(models.Model):