authentik.stages.prompt.migrations.0001_initial

  1# Generated by Django 3.1.1 on 2020-09-09 08:40
  2
  3import uuid
  4
  5import django.db.models.deletion
  6from django.db import migrations, models
  7
  8
  9class Migration(migrations.Migration):
 10    initial = True
 11
 12    dependencies = [
 13        ("authentik_flows", "0007_auto_20200703_2059"),
 14        ("authentik_policies", "0003_auto_20200908_1542"),
 15    ]
 16
 17    operations = [
 18        migrations.CreateModel(
 19            name="Prompt",
 20            fields=[
 21                (
 22                    "prompt_uuid",
 23                    models.UUIDField(
 24                        default=uuid.uuid4,
 25                        editable=False,
 26                        primary_key=True,
 27                        serialize=False,
 28                    ),
 29                ),
 30                (
 31                    "field_key",
 32                    models.SlugField(
 33                        help_text="Name of the form field, also used to store the value"
 34                    ),
 35                ),
 36                ("label", models.TextField()),
 37                (
 38                    "type",
 39                    models.CharField(
 40                        choices=[
 41                            ("text", "Text: Simple Text input"),
 42                            (
 43                                "username",
 44                                (
 45                                    "Username: Same as Text input, but checks for and prevents"
 46                                    " duplicate usernames."
 47                                ),
 48                            ),
 49                            ("email", "Email: Text field with Email type."),
 50                            ("password", "Password"),
 51                            ("number", "Number"),
 52                            ("checkbox", "Checkbox"),
 53                            ("data", "Date"),
 54                            ("data-time", "Date Time"),
 55                            ("separator", "Separator: Static Separator Line"),
 56                            (
 57                                "hidden",
 58                                "Hidden: Hidden field, can be used to insert data into form.",
 59                            ),
 60                            ("static", "Static: Static value, displayed as-is."),
 61                        ],
 62                        max_length=100,
 63                    ),
 64                ),
 65                ("required", models.BooleanField(default=True)),
 66                ("placeholder", models.TextField(blank=True)),
 67                ("order", models.IntegerField(default=0)),
 68            ],
 69            options={
 70                "verbose_name": "Prompt",
 71                "verbose_name_plural": "Prompts",
 72            },
 73        ),
 74        migrations.CreateModel(
 75            name="PromptStage",
 76            fields=[
 77                (
 78                    "stage_ptr",
 79                    models.OneToOneField(
 80                        auto_created=True,
 81                        on_delete=django.db.models.deletion.CASCADE,
 82                        parent_link=True,
 83                        primary_key=True,
 84                        serialize=False,
 85                        to="authentik_flows.stage",
 86                    ),
 87                ),
 88                ("fields", models.ManyToManyField(to="authentik_stages_prompt.Prompt")),
 89                (
 90                    "validation_policies",
 91                    models.ManyToManyField(blank=True, to="authentik_policies.Policy"),
 92                ),
 93            ],
 94            options={
 95                "verbose_name": "Prompt Stage",
 96                "verbose_name_plural": "Prompt Stages",
 97            },
 98            bases=("authentik_flows.stage",),
 99        ),
100    ]
class Migration(django.db.migrations.migration.Migration):
 10class Migration(migrations.Migration):
 11    initial = True
 12
 13    dependencies = [
 14        ("authentik_flows", "0007_auto_20200703_2059"),
 15        ("authentik_policies", "0003_auto_20200908_1542"),
 16    ]
 17
 18    operations = [
 19        migrations.CreateModel(
 20            name="Prompt",
 21            fields=[
 22                (
 23                    "prompt_uuid",
 24                    models.UUIDField(
 25                        default=uuid.uuid4,
 26                        editable=False,
 27                        primary_key=True,
 28                        serialize=False,
 29                    ),
 30                ),
 31                (
 32                    "field_key",
 33                    models.SlugField(
 34                        help_text="Name of the form field, also used to store the value"
 35                    ),
 36                ),
 37                ("label", models.TextField()),
 38                (
 39                    "type",
 40                    models.CharField(
 41                        choices=[
 42                            ("text", "Text: Simple Text input"),
 43                            (
 44                                "username",
 45                                (
 46                                    "Username: Same as Text input, but checks for and prevents"
 47                                    " duplicate usernames."
 48                                ),
 49                            ),
 50                            ("email", "Email: Text field with Email type."),
 51                            ("password", "Password"),
 52                            ("number", "Number"),
 53                            ("checkbox", "Checkbox"),
 54                            ("data", "Date"),
 55                            ("data-time", "Date Time"),
 56                            ("separator", "Separator: Static Separator Line"),
 57                            (
 58                                "hidden",
 59                                "Hidden: Hidden field, can be used to insert data into form.",
 60                            ),
 61                            ("static", "Static: Static value, displayed as-is."),
 62                        ],
 63                        max_length=100,
 64                    ),
 65                ),
 66                ("required", models.BooleanField(default=True)),
 67                ("placeholder", models.TextField(blank=True)),
 68                ("order", models.IntegerField(default=0)),
 69            ],
 70            options={
 71                "verbose_name": "Prompt",
 72                "verbose_name_plural": "Prompts",
 73            },
 74        ),
 75        migrations.CreateModel(
 76            name="PromptStage",
 77            fields=[
 78                (
 79                    "stage_ptr",
 80                    models.OneToOneField(
 81                        auto_created=True,
 82                        on_delete=django.db.models.deletion.CASCADE,
 83                        parent_link=True,
 84                        primary_key=True,
 85                        serialize=False,
 86                        to="authentik_flows.stage",
 87                    ),
 88                ),
 89                ("fields", models.ManyToManyField(to="authentik_stages_prompt.Prompt")),
 90                (
 91                    "validation_policies",
 92                    models.ManyToManyField(blank=True, to="authentik_policies.Policy"),
 93                ),
 94            ],
 95            options={
 96                "verbose_name": "Prompt Stage",
 97                "verbose_name_plural": "Prompt Stages",
 98            },
 99            bases=("authentik_flows.stage",),
100        ),
101    ]

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_flows', '0007_auto_20200703_2059'), ('authentik_policies', '0003_auto_20200908_1542')]
operations = [<CreateModel name='Prompt', fields=[('prompt_uuid', <django.db.models.fields.UUIDField>), ('field_key', <django.db.models.fields.SlugField>), ('label', <django.db.models.fields.TextField>), ('type', <django.db.models.fields.CharField>), ('required', <django.db.models.fields.BooleanField>), ('placeholder', <django.db.models.fields.TextField>), ('order', <django.db.models.fields.IntegerField>)], options={'verbose_name': 'Prompt', 'verbose_name_plural': 'Prompts'}>, <CreateModel name='PromptStage', fields=[('stage_ptr', <django.db.models.fields.related.OneToOneField>), ('fields', <django.db.models.fields.related.ManyToManyField>), ('validation_policies', <django.db.models.fields.related.ManyToManyField>)], options={'verbose_name': 'Prompt Stage', 'verbose_name_plural': 'Prompt Stages'}, bases=('authentik_flows.stage',)>]