authentik.events.migrations.0021_remove_event_authentik_e_user_1be48d_idx_and_more

 1# Generated by Django 5.2.19 on 2026-11-07 17:46
 2
 3import django.db.models.lookups
 4from django.conf import settings
 5from django.db import migrations, models
 6
 7
 8class Migration(migrations.Migration):
 9
10    dependencies = [
11        ("authentik_events", "0020_alter_event_action"),
12        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
13    ]
14
15    operations = [
16        migrations.RemoveIndex(
17            model_name="event",
18            name="authentik_e_user_1be48d_idx",
19        ),
20        migrations.RemoveIndex(
21            model_name="event",
22            name="authentik_e_created_6f0834_idx",
23        ),
24        migrations.RemoveIndex(
25            model_name="event",
26            name="authentik_e_ctx_app__idx",
27        ),
28        migrations.AddIndex(
29            model_name="event",
30            index=models.Index(
31                fields=["created"],
32                include=("action", "expires", "expiring"),
33                name="authentik_e_created_cov_idx",
34            ),
35        ),
36        migrations.AddIndex(
37            model_name="event",
38            index=models.Index(
39                models.F("context__authorized_application__pk"),
40                models.F("created"),
41                condition=models.Q(
42                    django.db.models.lookups.IsNull(
43                        models.F("context__authorized_application__pk"), False
44                    )
45                ),
46                name="authentik_e_ctx_app_pk_idx",
47            ),
48        ),
49        migrations.AddIndex(
50            model_name="event",
51            index=models.Index(
52                models.F("context__model__pk"),
53                models.F("action"),
54                name="authentik_e_ctx_model_pk_idx",
55            ),
56        ),
57        migrations.AddIndex(
58            model_name="event",
59            index=models.Index(
60                models.F("context__username"),
61                condition=models.Q(
62                    django.db.models.lookups.IsNull(models.F("context__username"), False)
63                ),
64                name="authentik_e_ctx_username_idx",
65            ),
66        ),
67        migrations.AddIndex(
68            model_name="event",
69            index=models.Index(models.F("user__username"), name="authentik_e_user_username_idx"),
70        ),
71        migrations.AddIndex(
72            model_name="notification",
73            index=models.Index(
74                condition=models.Q(("seen", False)),
75                fields=["user", "created"],
76                name="authentik_e_notif_unseen_idx",
77            ),
78        ),
79    ]
class Migration(django.db.migrations.migration.Migration):
 9class Migration(migrations.Migration):
10
11    dependencies = [
12        ("authentik_events", "0020_alter_event_action"),
13        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14    ]
15
16    operations = [
17        migrations.RemoveIndex(
18            model_name="event",
19            name="authentik_e_user_1be48d_idx",
20        ),
21        migrations.RemoveIndex(
22            model_name="event",
23            name="authentik_e_created_6f0834_idx",
24        ),
25        migrations.RemoveIndex(
26            model_name="event",
27            name="authentik_e_ctx_app__idx",
28        ),
29        migrations.AddIndex(
30            model_name="event",
31            index=models.Index(
32                fields=["created"],
33                include=("action", "expires", "expiring"),
34                name="authentik_e_created_cov_idx",
35            ),
36        ),
37        migrations.AddIndex(
38            model_name="event",
39            index=models.Index(
40                models.F("context__authorized_application__pk"),
41                models.F("created"),
42                condition=models.Q(
43                    django.db.models.lookups.IsNull(
44                        models.F("context__authorized_application__pk"), False
45                    )
46                ),
47                name="authentik_e_ctx_app_pk_idx",
48            ),
49        ),
50        migrations.AddIndex(
51            model_name="event",
52            index=models.Index(
53                models.F("context__model__pk"),
54                models.F("action"),
55                name="authentik_e_ctx_model_pk_idx",
56            ),
57        ),
58        migrations.AddIndex(
59            model_name="event",
60            index=models.Index(
61                models.F("context__username"),
62                condition=models.Q(
63                    django.db.models.lookups.IsNull(models.F("context__username"), False)
64                ),
65                name="authentik_e_ctx_username_idx",
66            ),
67        ),
68        migrations.AddIndex(
69            model_name="event",
70            index=models.Index(models.F("user__username"), name="authentik_e_user_username_idx"),
71        ),
72        migrations.AddIndex(
73            model_name="notification",
74            index=models.Index(
75                condition=models.Q(("seen", False)),
76                fields=["user", "created"],
77                name="authentik_e_notif_unseen_idx",
78            ),
79        ),
80    ]

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

dependencies = [('authentik_events', '0020_alter_event_action'), ('authentik_core', '__first__')]
operations = [<RemoveIndex model_name='event', name='authentik_e_user_1be48d_idx'>, <RemoveIndex model_name='event', name='authentik_e_created_6f0834_idx'>, <RemoveIndex model_name='event', name='authentik_e_ctx_app__idx'>, <AddIndex model_name='event', index=<Index: fields=['created'] name='authentik_e_created_cov_idx' include=('action', 'expires', 'expiring')>>, <AddIndex model_name='event', index=<Index: expressions=(F(context__authorized_application__pk), F(created)) name='authentik_e_ctx_app_pk_idx' condition=(AND: IsNull(F(context__authorized_application__pk), False))>>, <AddIndex model_name='event', index=<Index: expressions=(F(context__model__pk), F(action)) name='authentik_e_ctx_model_pk_idx'>>, <AddIndex model_name='event', index=<Index: expressions=(F(context__username),) name='authentik_e_ctx_username_idx' condition=(AND: IsNull(F(context__username), False))>>, <AddIndex model_name='event', index=<Index: expressions=(F(user__username),) name='authentik_e_user_username_idx'>>, <AddIndex model_name='notification', index=<Index: fields=['user', 'created'] name='authentik_e_notif_unseen_idx' condition=(AND: ('seen', False))>>]