Skip to content

Commit

Permalink
Adjust locations indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Jan 10, 2025
1 parent 27384fa commit 7940785
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.4 on 2025-01-09 08:50
# Generated by Django 5.1.4 on 2025-01-10 09:52

import mptt.fields

Expand All @@ -13,7 +13,7 @@ class Migration(migrations.Migration):

dependencies = [
("locations", "0032_squashed"),
("orgs", "0163_squashed"),
("orgs", "0164_remove_viewers"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

Expand Down Expand Up @@ -99,10 +99,10 @@ class Migration(migrations.Migration):
),
migrations.AddIndex(
model_name="location",
index=models.Index(django.db.models.functions.text.Upper("name"), name="locations_by_name"),
index=models.Index(django.db.models.functions.text.Lower("name"), name="locations_by_name"),
),
migrations.AddIndex(
model_name="locationalias",
index=models.Index(django.db.models.functions.text.Upper("name"), name="locationaliases_by_name"),
index=models.Index(django.db.models.functions.text.Lower("name"), name="locationaliases_by_name"),
),
]
6 changes: 3 additions & 3 deletions temba/locations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.contrib.gis.db import models
from django.db.models import F, Value
from django.db.models.functions import Concat, Upper
from django.db.models.functions import Concat, Lower, Upper


# default manager for AdminBoundary, doesn't load geometries
Expand Down Expand Up @@ -208,7 +208,7 @@ class Location(MPTTModel, models.Model):
geometries = GeometryManager()

class Meta:
indexes = [models.Index(Upper("name"), name="locations_by_name")]
indexes = [models.Index(Lower("name"), name="locations_by_name")]


class LocationAlias(SmartModel):
Expand All @@ -221,4 +221,4 @@ class LocationAlias(SmartModel):
name = models.CharField(max_length=Location.MAX_NAME_LEN, help_text="The name for our alias")

class Meta:
indexes = [models.Index(Upper("name"), name="locationaliases_by_name")]
indexes = [models.Index(Lower("name"), name="locationaliases_by_name")]
2 changes: 1 addition & 1 deletion temba/orgs/migrations/0165_org_location.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.4 on 2025-01-09 09:39
# Generated by Django 5.1.4 on 2025-01-10 09:52

import django.db.models.deletion
from django.db import migrations, models
Expand Down

0 comments on commit 7940785

Please sign in to comment.