Add index for finding active (and local) users

This commit is contained in:
Bart Schuurmans 2024-04-03 21:23:24 +02:00
parent 0501ce39cd
commit 464a0298c6
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 3.2.25 on 2024-04-03 19:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0202_user_bookwyrm_us_usernam_b2546d_idx"),
]
operations = [
migrations.AddIndex(
model_name="user",
index=models.Index(
fields=["is_active", "local"], name="bookwyrm_us_is_acti_972dc4_idx"
),
),
]

View file

@ -203,6 +203,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
indexes = [
models.Index(fields=["username"]),
models.Index(fields=["is_active", "local"]),
]
@property