authentik.providers.oauth2.migrations.0023_alter_accesstoken_refreshtoken_use_hash_index

 1# Generated by Django 5.0.9 on 2024-10-31 14:28
 2
 3import django.contrib.postgres.indexes
 4from django.conf import settings
 5from django.db import migrations
 6
 7
 8class Migration(migrations.Migration):
 9
10    dependencies = [
11        ("authentik_core", "0039_source_group_matching_mode_alter_group_name_and_more"),
12        ("authentik_providers_oauth2", "0022_remove_accesstoken_session_id_and_more"),
13        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14    ]
15
16    operations = [
17        migrations.RunSQL("DROP INDEX IF EXISTS authentik_p_token_f99422_idx;"),
18        migrations.RunSQL("DROP INDEX IF EXISTS authentik_p_token_a1d921_idx;"),
19        migrations.AddIndex(
20            model_name="accesstoken",
21            index=django.contrib.postgres.indexes.HashIndex(
22                fields=["token"], name="authentik_p_token_e00883_hash"
23            ),
24        ),
25        migrations.AddIndex(
26            model_name="refreshtoken",
27            index=django.contrib.postgres.indexes.HashIndex(
28                fields=["token"], name="authentik_p_token_32e2b7_hash"
29            ),
30        ),
31    ]
class Migration(django.db.migrations.migration.Migration):
 9class Migration(migrations.Migration):
10
11    dependencies = [
12        ("authentik_core", "0039_source_group_matching_mode_alter_group_name_and_more"),
13        ("authentik_providers_oauth2", "0022_remove_accesstoken_session_id_and_more"),
14        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15    ]
16
17    operations = [
18        migrations.RunSQL("DROP INDEX IF EXISTS authentik_p_token_f99422_idx;"),
19        migrations.RunSQL("DROP INDEX IF EXISTS authentik_p_token_a1d921_idx;"),
20        migrations.AddIndex(
21            model_name="accesstoken",
22            index=django.contrib.postgres.indexes.HashIndex(
23                fields=["token"], name="authentik_p_token_e00883_hash"
24            ),
25        ),
26        migrations.AddIndex(
27            model_name="refreshtoken",
28            index=django.contrib.postgres.indexes.HashIndex(
29                fields=["token"], name="authentik_p_token_32e2b7_hash"
30            ),
31        ),
32    ]

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_core', '0039_source_group_matching_mode_alter_group_name_and_more'), ('authentik_providers_oauth2', '0022_remove_accesstoken_session_id_and_more'), ('authentik_core', '__first__')]
operations = [<RunSQL 'DROP INDEX IF EXISTS authentik_p_token_f99422_idx;'>, <RunSQL 'DROP INDEX IF EXISTS authentik_p_token_a1d921_idx;'>, <AddIndex model_name='accesstoken', index=<HashIndex: fields=['token'] name='authentik_p_token_e00883_hash'>>, <AddIndex model_name='refreshtoken', index=<HashIndex: fields=['token'] name='authentik_p_token_32e2b7_hash'>>]