mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
This index is used by `active_users_audit:is_bot:day`, and provides roughly a 2x speedup. The existing `zerver_realmauditlog_realm__event_type__event_time` is used if there is a realm limit, but the standard statistics fill runs for all realms at once, and thus cannot use it.
27 lines
864 B
Python
27 lines
864 B
Python
from django.contrib.postgres.operations import AddIndexConcurrently
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
atomic = False
|
|
|
|
dependencies = [
|
|
("zerver", "0527_presencesequence"),
|
|
]
|
|
|
|
operations = [
|
|
AddIndexConcurrently(
|
|
model_name="realmauditlog",
|
|
index=models.Index(
|
|
# event_type__in:
|
|
# AbstractRealmAuditLog.USER_CREATED,
|
|
# AbstractRealmAuditLog.USER_ACTIVATED,
|
|
# AbstractRealmAuditLog.USER_DEACTIVATED,
|
|
# AbstractRealmAuditLog.USER_REACTIVATED,
|
|
condition=models.Q(("event_type__in", [101, 102, 103, 104])),
|
|
fields=["modified_user", "event_time"],
|
|
name="zerver_realmauditlog_user_activations_idx",
|
|
),
|
|
),
|
|
]
|