Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Upper index for email in EmailAddress model #3382

Merged
merged 4 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions allauth/account/migrations/0005_emailaddress_idx_upper_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.4 on 2023-08-23 18:17

import django.db.models.functions.text
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("account", "0004_alter_emailaddress_drop_unique_email"),
]

operations = [
migrations.AddIndex(
model_name="emailaddress",
index=models.Index(
django.db.models.functions.text.Upper("email"),
name="account_emailaddress_upper_email",
),
),
]
4 changes: 3 additions & 1 deletion allauth/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from django.core import signing
from django.db import models
from django.db.models import Q
from django.db.models import Index, Q
from django.db.models.constraints import UniqueConstraint
from django.db.models.functions import Upper
from django.utils import timezone
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -41,6 +42,7 @@ class Meta:
condition=Q(verified=True),
)
]
indexes = [Index(Upper("email"), name="account_emailaddress_upper_email")]

def __str__(self):
return self.email
Expand Down