authentik.sources.telegram.migrations.0001_initial

  1# Generated by Django 5.1.12 on 2025-09-24 07:14
  2
  3import django.db.models.deletion
  4from django.db import migrations, models
  5
  6
  7class Migration(migrations.Migration):
  8
  9    initial = True
 10
 11    dependencies = [
 12        ("authentik_core", "0050_user_last_updated_and_more"),
 13        ("authentik_flows", "0028_flowtoken_revoke_on_execution"),
 14    ]
 15
 16    operations = [
 17        migrations.CreateModel(
 18            name="GroupTelegramSourceConnection",
 19            fields=[
 20                (
 21                    "groupsourceconnection_ptr",
 22                    models.OneToOneField(
 23                        auto_created=True,
 24                        on_delete=django.db.models.deletion.CASCADE,
 25                        parent_link=True,
 26                        primary_key=True,
 27                        serialize=False,
 28                        to="authentik_core.groupsourceconnection",
 29                    ),
 30                ),
 31            ],
 32            options={
 33                "verbose_name": "Group Telegram Source Connection",
 34                "verbose_name_plural": "Group Telegram Source Connections",
 35            },
 36            bases=("authentik_core.groupsourceconnection",),
 37        ),
 38        migrations.CreateModel(
 39            name="TelegramSourcePropertyMapping",
 40            fields=[
 41                (
 42                    "propertymapping_ptr",
 43                    models.OneToOneField(
 44                        auto_created=True,
 45                        on_delete=django.db.models.deletion.CASCADE,
 46                        parent_link=True,
 47                        primary_key=True,
 48                        serialize=False,
 49                        to="authentik_core.propertymapping",
 50                    ),
 51                ),
 52            ],
 53            options={
 54                "verbose_name": "Telegram Source Property Mapping",
 55                "verbose_name_plural": "Telegram Source Property Mappings",
 56            },
 57            bases=("authentik_core.propertymapping",),
 58        ),
 59        migrations.CreateModel(
 60            name="UserTelegramSourceConnection",
 61            fields=[
 62                (
 63                    "usersourceconnection_ptr",
 64                    models.OneToOneField(
 65                        auto_created=True,
 66                        on_delete=django.db.models.deletion.CASCADE,
 67                        parent_link=True,
 68                        primary_key=True,
 69                        serialize=False,
 70                        to="authentik_core.usersourceconnection",
 71                    ),
 72                ),
 73            ],
 74            options={
 75                "verbose_name": "User Telegram Source Connection",
 76                "verbose_name_plural": "User Telegram Source Connections",
 77            },
 78            bases=("authentik_core.usersourceconnection",),
 79        ),
 80        migrations.CreateModel(
 81            name="TelegramSource",
 82            fields=[
 83                (
 84                    "source_ptr",
 85                    models.OneToOneField(
 86                        auto_created=True,
 87                        on_delete=django.db.models.deletion.CASCADE,
 88                        parent_link=True,
 89                        primary_key=True,
 90                        serialize=False,
 91                        to="authentik_core.source",
 92                    ),
 93                ),
 94                ("bot_username", models.TextField(help_text="Telegram bot username")),
 95                ("bot_token", models.TextField(help_text="Telegram bot token")),
 96                (
 97                    "request_message_access",
 98                    models.BooleanField(
 99                        default=False, help_text="Request access to send messages from your bot."
100                    ),
101                ),
102                (
103                    "pre_authentication_flow",
104                    models.ForeignKey(
105                        help_text="Flow used before authentication.",
106                        on_delete=django.db.models.deletion.CASCADE,
107                        related_name="telegram_source_pre_authentication",
108                        to="authentik_flows.flow",
109                    ),
110                ),
111            ],
112            options={
113                "verbose_name": "Telegram Source",
114                "verbose_name_plural": "Telegram Sources",
115            },
116            bases=("authentik_core.source",),
117        ),
118    ]
class Migration(django.db.migrations.migration.Migration):
  8class Migration(migrations.Migration):
  9
 10    initial = True
 11
 12    dependencies = [
 13        ("authentik_core", "0050_user_last_updated_and_more"),
 14        ("authentik_flows", "0028_flowtoken_revoke_on_execution"),
 15    ]
 16
 17    operations = [
 18        migrations.CreateModel(
 19            name="GroupTelegramSourceConnection",
 20            fields=[
 21                (
 22                    "groupsourceconnection_ptr",
 23                    models.OneToOneField(
 24                        auto_created=True,
 25                        on_delete=django.db.models.deletion.CASCADE,
 26                        parent_link=True,
 27                        primary_key=True,
 28                        serialize=False,
 29                        to="authentik_core.groupsourceconnection",
 30                    ),
 31                ),
 32            ],
 33            options={
 34                "verbose_name": "Group Telegram Source Connection",
 35                "verbose_name_plural": "Group Telegram Source Connections",
 36            },
 37            bases=("authentik_core.groupsourceconnection",),
 38        ),
 39        migrations.CreateModel(
 40            name="TelegramSourcePropertyMapping",
 41            fields=[
 42                (
 43                    "propertymapping_ptr",
 44                    models.OneToOneField(
 45                        auto_created=True,
 46                        on_delete=django.db.models.deletion.CASCADE,
 47                        parent_link=True,
 48                        primary_key=True,
 49                        serialize=False,
 50                        to="authentik_core.propertymapping",
 51                    ),
 52                ),
 53            ],
 54            options={
 55                "verbose_name": "Telegram Source Property Mapping",
 56                "verbose_name_plural": "Telegram Source Property Mappings",
 57            },
 58            bases=("authentik_core.propertymapping",),
 59        ),
 60        migrations.CreateModel(
 61            name="UserTelegramSourceConnection",
 62            fields=[
 63                (
 64                    "usersourceconnection_ptr",
 65                    models.OneToOneField(
 66                        auto_created=True,
 67                        on_delete=django.db.models.deletion.CASCADE,
 68                        parent_link=True,
 69                        primary_key=True,
 70                        serialize=False,
 71                        to="authentik_core.usersourceconnection",
 72                    ),
 73                ),
 74            ],
 75            options={
 76                "verbose_name": "User Telegram Source Connection",
 77                "verbose_name_plural": "User Telegram Source Connections",
 78            },
 79            bases=("authentik_core.usersourceconnection",),
 80        ),
 81        migrations.CreateModel(
 82            name="TelegramSource",
 83            fields=[
 84                (
 85                    "source_ptr",
 86                    models.OneToOneField(
 87                        auto_created=True,
 88                        on_delete=django.db.models.deletion.CASCADE,
 89                        parent_link=True,
 90                        primary_key=True,
 91                        serialize=False,
 92                        to="authentik_core.source",
 93                    ),
 94                ),
 95                ("bot_username", models.TextField(help_text="Telegram bot username")),
 96                ("bot_token", models.TextField(help_text="Telegram bot token")),
 97                (
 98                    "request_message_access",
 99                    models.BooleanField(
100                        default=False, help_text="Request access to send messages from your bot."
101                    ),
102                ),
103                (
104                    "pre_authentication_flow",
105                    models.ForeignKey(
106                        help_text="Flow used before authentication.",
107                        on_delete=django.db.models.deletion.CASCADE,
108                        related_name="telegram_source_pre_authentication",
109                        to="authentik_flows.flow",
110                    ),
111                ),
112            ],
113            options={
114                "verbose_name": "Telegram Source",
115                "verbose_name_plural": "Telegram Sources",
116            },
117            bases=("authentik_core.source",),
118        ),
119    ]

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.

initial = True
dependencies = [('authentik_core', '0050_user_last_updated_and_more'), ('authentik_flows', '0028_flowtoken_revoke_on_execution')]
operations = [<CreateModel name='GroupTelegramSourceConnection', fields=[('groupsourceconnection_ptr', <django.db.models.fields.related.OneToOneField>)], options={'verbose_name': 'Group Telegram Source Connection', 'verbose_name_plural': 'Group Telegram Source Connections'}, bases=('authentik_core.groupsourceconnection',)>, <CreateModel name='TelegramSourcePropertyMapping', fields=[('propertymapping_ptr', <django.db.models.fields.related.OneToOneField>)], options={'verbose_name': 'Telegram Source Property Mapping', 'verbose_name_plural': 'Telegram Source Property Mappings'}, bases=('authentik_core.propertymapping',)>, <CreateModel name='UserTelegramSourceConnection', fields=[('usersourceconnection_ptr', <django.db.models.fields.related.OneToOneField>)], options={'verbose_name': 'User Telegram Source Connection', 'verbose_name_plural': 'User Telegram Source Connections'}, bases=('authentik_core.usersourceconnection',)>, <CreateModel name='TelegramSource', fields=[('source_ptr', <django.db.models.fields.related.OneToOneField>), ('bot_username', <django.db.models.fields.TextField>), ('bot_token', <django.db.models.fields.TextField>), ('request_message_access', <django.db.models.fields.BooleanField>), ('pre_authentication_flow', <django.db.models.fields.related.ForeignKey>)], options={'verbose_name': 'Telegram Source', 'verbose_name_plural': 'Telegram Sources'}, bases=('authentik_core.source',)>]