diff --git a/authentik/events/migrations/0007_event_authentik_e_action_9a9dd9_idx_and_more.py b/authentik/events/migrations/0007_event_authentik_e_action_9a9dd9_idx_and_more.py new file mode 100644 index 0000000000..e2dd02c3d1 --- /dev/null +++ b/authentik/events/migrations/0007_event_authentik_e_action_9a9dd9_idx_and_more.py @@ -0,0 +1,39 @@ +# Generated by Django 5.0.4 on 2024-04-15 16:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_events", "0006_alter_systemtask_expires"), + ] + + operations = [ + migrations.AddIndex( + model_name="event", + index=models.Index(fields=["action"], name="authentik_e_action_9a9dd9_idx"), + ), + migrations.AddIndex( + model_name="event", + index=models.Index(fields=["user"], name="authentik_e_user_1be48d_idx"), + ), + migrations.AddIndex( + model_name="event", + index=models.Index(fields=["app"], name="authentik_e_app_6a05ce_idx"), + ), + migrations.AddIndex( + model_name="event", + index=models.Index(fields=["created"], name="authentik_e_created_6f0834_idx"), + ), + migrations.AddIndex( + model_name="event", + index=models.Index(fields=["client_ip"], name="authentik_e_client__51f4dd_idx"), + ), + migrations.AddIndex( + model_name="event", + index=models.Index( + models.F("context__authorized_application"), name="authentik_e_ctx_app__idx" + ), + ), + ] diff --git a/authentik/events/models.py b/authentik/events/models.py index c76931f93d..bea93dccd3 100644 --- a/authentik/events/models.py +++ b/authentik/events/models.py @@ -305,6 +305,16 @@ class Event(SerializerModel, ExpiringModel): class Meta: verbose_name = _("Event") verbose_name_plural = _("Events") + indexes = [ + models.Index(fields=["action"]), + models.Index(fields=["user"]), + models.Index(fields=["app"]), + models.Index(fields=["created"]), + models.Index(fields=["client_ip"]), + models.Index( + models.F("context__authorized_application"), name="authentik_e_ctx_app__idx" + ), + ] class TransportMode(models.TextChoices):