authentik.stages.authenticator_static.migrations.0008_initial

 1from django.conf import settings
 2from django.db import migrations, models
 3
 4
 5class Migration(migrations.Migration):
 6    dependencies = [
 7        (
 8            "authentik_stages_authenticator_static",
 9            "0007_authenticatorstaticstage_token_length_and_more",
10        ),
11        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12    ]
13
14    operations = [
15        migrations.CreateModel(
16            name="StaticDevice",
17            fields=[
18                (
19                    "id",
20                    models.AutoField(
21                        verbose_name="ID", serialize=False, auto_created=True, primary_key=True
22                    ),
23                ),
24                (
25                    "name",
26                    models.CharField(
27                        help_text="The human-readable name of this device.", max_length=64
28                    ),
29                ),
30                (
31                    "confirmed",
32                    models.BooleanField(default=True, help_text="Is this device ready for use?"),
33                ),
34                (
35                    "user",
36                    models.ForeignKey(
37                        help_text="The user that this device belongs to.",
38                        to=settings.AUTH_USER_MODEL,
39                        on_delete=models.CASCADE,
40                    ),
41                ),
42            ],
43            options={
44                "abstract": False,
45            },
46            bases=(models.Model,),
47        ),
48        migrations.CreateModel(
49            name="StaticToken",
50            fields=[
51                (
52                    "id",
53                    models.AutoField(
54                        verbose_name="ID", serialize=False, auto_created=True, primary_key=True
55                    ),
56                ),
57                ("token", models.CharField(max_length=16, db_index=True)),
58                (
59                    "device",
60                    models.ForeignKey(
61                        related_name="token_set",
62                        to="authentik_stages_authenticator_static.staticdevice",
63                        on_delete=models.CASCADE,
64                    ),
65                ),
66            ],
67            options={},
68            bases=(models.Model,),
69        ),
70    ]
class Migration(django.db.migrations.migration.Migration):
 6class Migration(migrations.Migration):
 7    dependencies = [
 8        (
 9            "authentik_stages_authenticator_static",
10            "0007_authenticatorstaticstage_token_length_and_more",
11        ),
12        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
13    ]
14
15    operations = [
16        migrations.CreateModel(
17            name="StaticDevice",
18            fields=[
19                (
20                    "id",
21                    models.AutoField(
22                        verbose_name="ID", serialize=False, auto_created=True, primary_key=True
23                    ),
24                ),
25                (
26                    "name",
27                    models.CharField(
28                        help_text="The human-readable name of this device.", max_length=64
29                    ),
30                ),
31                (
32                    "confirmed",
33                    models.BooleanField(default=True, help_text="Is this device ready for use?"),
34                ),
35                (
36                    "user",
37                    models.ForeignKey(
38                        help_text="The user that this device belongs to.",
39                        to=settings.AUTH_USER_MODEL,
40                        on_delete=models.CASCADE,
41                    ),
42                ),
43            ],
44            options={
45                "abstract": False,
46            },
47            bases=(models.Model,),
48        ),
49        migrations.CreateModel(
50            name="StaticToken",
51            fields=[
52                (
53                    "id",
54                    models.AutoField(
55                        verbose_name="ID", serialize=False, auto_created=True, primary_key=True
56                    ),
57                ),
58                ("token", models.CharField(max_length=16, db_index=True)),
59                (
60                    "device",
61                    models.ForeignKey(
62                        related_name="token_set",
63                        to="authentik_stages_authenticator_static.staticdevice",
64                        on_delete=models.CASCADE,
65                    ),
66                ),
67            ],
68            options={},
69            bases=(models.Model,),
70        ),
71    ]

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_stages_authenticator_static', '0007_authenticatorstaticstage_token_length_and_more'), ('authentik_core', '__first__')]
operations = [<CreateModel name='StaticDevice', fields=[('id', <django.db.models.fields.AutoField>), ('name', <django.db.models.fields.CharField>), ('confirmed', <django.db.models.fields.BooleanField>), ('user', <django.db.models.fields.related.ForeignKey>)], options={'abstract': False}, bases=(<class 'django.db.models.base.Model'>,)>, <CreateModel name='StaticToken', fields=[('id', <django.db.models.fields.AutoField>), ('token', <django.db.models.fields.CharField>), ('device', <django.db.models.fields.related.ForeignKey>)], options={}, bases=(<class 'django.db.models.base.Model'>,)>]