authentik.providers.ldap.migrations.0001_squashed_0005_ldapprovider_search_mode

  1# Generated by Django 3.2.8 on 2021-11-05 09:41
  2
  3import django.db.models.deletion
  4from django.db import migrations, models
  5
  6
  7class Migration(migrations.Migration):
  8    replaces = [
  9        ("authentik_providers_ldap", "0001_initial"),
 10        ("authentik_providers_ldap", "0002_ldapprovider_search_group"),
 11        ("authentik_providers_ldap", "0003_auto_20210713_1138"),
 12        ("authentik_providers_ldap", "0004_auto_20210713_2115"),
 13        ("authentik_providers_ldap", "0005_ldapprovider_search_mode"),
 14    ]
 15
 16    initial = True
 17
 18    dependencies = [
 19        ("authentik_core", "0019_source_managed"),
 20        ("authentik_crypto", "0002_create_self_signed_kp"),
 21    ]
 22
 23    operations = [
 24        migrations.CreateModel(
 25            name="LDAPProvider",
 26            fields=[
 27                (
 28                    "provider_ptr",
 29                    models.OneToOneField(
 30                        auto_created=True,
 31                        on_delete=django.db.models.deletion.CASCADE,
 32                        parent_link=True,
 33                        primary_key=True,
 34                        serialize=False,
 35                        to="authentik_core.provider",
 36                    ),
 37                ),
 38                (
 39                    "base_dn",
 40                    models.TextField(
 41                        default="DC=ldap,DC=goauthentik,DC=io",
 42                        help_text="DN under which objects are accessible.",
 43                    ),
 44                ),
 45                (
 46                    "search_group",
 47                    models.ForeignKey(
 48                        default=None,
 49                        help_text=(
 50                            "Users in this group can do search queries. If not set, every user can"
 51                            " execute search queries."
 52                        ),
 53                        null=True,
 54                        on_delete=django.db.models.deletion.SET_DEFAULT,
 55                        to="authentik_core.group",
 56                    ),
 57                ),
 58                (
 59                    "certificate",
 60                    models.ForeignKey(
 61                        blank=True,
 62                        null=True,
 63                        on_delete=django.db.models.deletion.SET_NULL,
 64                        to="authentik_crypto.certificatekeypair",
 65                    ),
 66                ),
 67                ("tls_server_name", models.TextField(blank=True, default="")),
 68                (
 69                    "gid_start_number",
 70                    models.IntegerField(
 71                        default=4000,
 72                        help_text=(
 73                            "The start for gidNumbers, this number is added to a number generated"
 74                            " from the group.Pk to make sure that the numbers aren't too low for"
 75                            " POSIX groups. Default is 4000 to ensure that we don't collide with"
 76                            " local groups or users primary groups gidNumber"
 77                        ),
 78                    ),
 79                ),
 80                (
 81                    "uid_start_number",
 82                    models.IntegerField(
 83                        default=2000,
 84                        help_text=(
 85                            "The start for uidNumbers, this number is added to the user.Pk to make"
 86                            " sure that the numbers aren't too low for POSIX users. Default is 2000"
 87                            " to ensure that we don't collide with local users uidNumber"
 88                        ),
 89                    ),
 90                ),
 91                (
 92                    "search_mode",
 93                    models.TextField(
 94                        choices=[("direct", "Direct"), ("cached", "Cached")], default="direct"
 95                    ),
 96                ),
 97            ],
 98            options={
 99                "verbose_name": "LDAP Provider",
100                "verbose_name_plural": "LDAP Providers",
101            },
102            bases=("authentik_core.provider", models.Model),
103        ),
104    ]
class Migration(django.db.migrations.migration.Migration):
  8class Migration(migrations.Migration):
  9    replaces = [
 10        ("authentik_providers_ldap", "0001_initial"),
 11        ("authentik_providers_ldap", "0002_ldapprovider_search_group"),
 12        ("authentik_providers_ldap", "0003_auto_20210713_1138"),
 13        ("authentik_providers_ldap", "0004_auto_20210713_2115"),
 14        ("authentik_providers_ldap", "0005_ldapprovider_search_mode"),
 15    ]
 16
 17    initial = True
 18
 19    dependencies = [
 20        ("authentik_core", "0019_source_managed"),
 21        ("authentik_crypto", "0002_create_self_signed_kp"),
 22    ]
 23
 24    operations = [
 25        migrations.CreateModel(
 26            name="LDAPProvider",
 27            fields=[
 28                (
 29                    "provider_ptr",
 30                    models.OneToOneField(
 31                        auto_created=True,
 32                        on_delete=django.db.models.deletion.CASCADE,
 33                        parent_link=True,
 34                        primary_key=True,
 35                        serialize=False,
 36                        to="authentik_core.provider",
 37                    ),
 38                ),
 39                (
 40                    "base_dn",
 41                    models.TextField(
 42                        default="DC=ldap,DC=goauthentik,DC=io",
 43                        help_text="DN under which objects are accessible.",
 44                    ),
 45                ),
 46                (
 47                    "search_group",
 48                    models.ForeignKey(
 49                        default=None,
 50                        help_text=(
 51                            "Users in this group can do search queries. If not set, every user can"
 52                            " execute search queries."
 53                        ),
 54                        null=True,
 55                        on_delete=django.db.models.deletion.SET_DEFAULT,
 56                        to="authentik_core.group",
 57                    ),
 58                ),
 59                (
 60                    "certificate",
 61                    models.ForeignKey(
 62                        blank=True,
 63                        null=True,
 64                        on_delete=django.db.models.deletion.SET_NULL,
 65                        to="authentik_crypto.certificatekeypair",
 66                    ),
 67                ),
 68                ("tls_server_name", models.TextField(blank=True, default="")),
 69                (
 70                    "gid_start_number",
 71                    models.IntegerField(
 72                        default=4000,
 73                        help_text=(
 74                            "The start for gidNumbers, this number is added to a number generated"
 75                            " from the group.Pk to make sure that the numbers aren't too low for"
 76                            " POSIX groups. Default is 4000 to ensure that we don't collide with"
 77                            " local groups or users primary groups gidNumber"
 78                        ),
 79                    ),
 80                ),
 81                (
 82                    "uid_start_number",
 83                    models.IntegerField(
 84                        default=2000,
 85                        help_text=(
 86                            "The start for uidNumbers, this number is added to the user.Pk to make"
 87                            " sure that the numbers aren't too low for POSIX users. Default is 2000"
 88                            " to ensure that we don't collide with local users uidNumber"
 89                        ),
 90                    ),
 91                ),
 92                (
 93                    "search_mode",
 94                    models.TextField(
 95                        choices=[("direct", "Direct"), ("cached", "Cached")], default="direct"
 96                    ),
 97                ),
 98            ],
 99            options={
100                "verbose_name": "LDAP Provider",
101                "verbose_name_plural": "LDAP Providers",
102            },
103            bases=("authentik_core.provider", models.Model),
104        ),
105    ]

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.

replaces = [('authentik_providers_ldap', '0001_initial'), ('authentik_providers_ldap', '0002_ldapprovider_search_group'), ('authentik_providers_ldap', '0003_auto_20210713_1138'), ('authentik_providers_ldap', '0004_auto_20210713_2115'), ('authentik_providers_ldap', '0005_ldapprovider_search_mode')]
initial = True
dependencies = [('authentik_core', '0019_source_managed'), ('authentik_crypto', '0002_create_self_signed_kp')]
operations = [<CreateModel name='LDAPProvider', fields=[('provider_ptr', <django.db.models.fields.related.OneToOneField>), ('base_dn', <django.db.models.fields.TextField>), ('search_group', <django.db.models.fields.related.ForeignKey>), ('certificate', <django.db.models.fields.related.ForeignKey>), ('tls_server_name', <django.db.models.fields.TextField>), ('gid_start_number', <django.db.models.fields.IntegerField>), ('uid_start_number', <django.db.models.fields.IntegerField>), ('search_mode', <django.db.models.fields.TextField>)], options={'verbose_name': 'LDAP Provider', 'verbose_name_plural': 'LDAP Providers'}, bases=('authentik_core.provider', <class 'django.db.models.base.Model'>)>]