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

audit-logs: Add index to RealmAuditLog for realm and event type. #29763

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions zerver/migrations/0510_add_realmauditlog_realm_event_type_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.12 on 2024-04-17 10:33

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("zerver", "0509_fix_emoji_metadata"),
]

operations = [
migrations.AddIndex(
model_name="realmauditlog",
index=models.Index(
fields=["realm", "event_type", "event_time"],
name="zerver_realmauditlog_realm__event_type__event_time",
),
),
]
6 changes: 5 additions & 1 deletion zerver/models/realm_audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class RealmAuditLog(AbstractRealmAuditLog):

class Meta:
indexes = [
models.Index(
name="zerver_realmauditlog_realm__event_type__event_time",
fields=["realm", "event_type", "event_time"],
),
models.Index(
name="zerver_realmauditlog_user_subscriptions_idx",
fields=["modified_user", "modified_stream"],
Expand All @@ -237,7 +241,7 @@ class Meta:
AbstractRealmAuditLog.SUBSCRIPTION_DEACTIVATED,
]
),
)
),
]

@override
Expand Down