authentik.enterprise.stages.source.migrations.0001_initial

 1# Generated by Django 5.0.2 on 2024-02-25 20:44
 2
 3import authentik.lib.utils.time
 4import django.db.models.deletion
 5from django.db import migrations, models
 6
 7
 8class Migration(migrations.Migration):
 9
10    initial = True
11
12    dependencies = [
13        ("authentik_core", "0033_alter_user_options"),
14        ("authentik_flows", "0027_auto_20231028_1424"),
15    ]
16
17    operations = [
18        migrations.CreateModel(
19            name="SourceStage",
20            fields=[
21                (
22                    "stage_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_flows.stage",
30                    ),
31                ),
32                (
33                    "resume_timeout",
34                    models.TextField(
35                        default="minutes=10",
36                        help_text="Amount of time a user can take to return from the source to continue the flow (Format: hours=-1;minutes=-2;seconds=-3)",
37                        validators=[authentik.lib.utils.time.timedelta_string_validator],
38                    ),
39                ),
40                (
41                    "source",
42                    models.ForeignKey(
43                        on_delete=django.db.models.deletion.CASCADE, to="authentik_core.source"
44                    ),
45                ),
46            ],
47            options={
48                "verbose_name": "Source Stage",
49                "verbose_name_plural": "Source Stages",
50            },
51            bases=("authentik_flows.stage",),
52        ),
53    ]
class Migration(django.db.migrations.migration.Migration):
 9class Migration(migrations.Migration):
10
11    initial = True
12
13    dependencies = [
14        ("authentik_core", "0033_alter_user_options"),
15        ("authentik_flows", "0027_auto_20231028_1424"),
16    ]
17
18    operations = [
19        migrations.CreateModel(
20            name="SourceStage",
21            fields=[
22                (
23                    "stage_ptr",
24                    models.OneToOneField(
25                        auto_created=True,
26                        on_delete=django.db.models.deletion.CASCADE,
27                        parent_link=True,
28                        primary_key=True,
29                        serialize=False,
30                        to="authentik_flows.stage",
31                    ),
32                ),
33                (
34                    "resume_timeout",
35                    models.TextField(
36                        default="minutes=10",
37                        help_text="Amount of time a user can take to return from the source to continue the flow (Format: hours=-1;minutes=-2;seconds=-3)",
38                        validators=[authentik.lib.utils.time.timedelta_string_validator],
39                    ),
40                ),
41                (
42                    "source",
43                    models.ForeignKey(
44                        on_delete=django.db.models.deletion.CASCADE, to="authentik_core.source"
45                    ),
46                ),
47            ],
48            options={
49                "verbose_name": "Source Stage",
50                "verbose_name_plural": "Source Stages",
51            },
52            bases=("authentik_flows.stage",),
53        ),
54    ]

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', '0033_alter_user_options'), ('authentik_flows', '0027_auto_20231028_1424')]
operations = [<CreateModel name='SourceStage', fields=[('stage_ptr', <django.db.models.fields.related.OneToOneField>), ('resume_timeout', <django.db.models.fields.TextField>), ('source', <django.db.models.fields.related.ForeignKey>)], options={'verbose_name': 'Source Stage', 'verbose_name_plural': 'Source Stages'}, bases=('authentik_flows.stage',)>]