authentik.core.migrations.0041_applicationentitlement

 1# Generated by Django 5.0.9 on 2024-11-20 15:16
 2
 3import django.db.models.deletion
 4from django.db import migrations, models
 5
 6
 7class Migration(migrations.Migration):
 8
 9    dependencies = [
10        ("authentik_core", "0040_provider_invalidation_flow"),
11        ("authentik_policies", "0011_policybinding_failure_result_and_more"),
12    ]
13
14    operations = [
15        migrations.CreateModel(
16            name="ApplicationEntitlement",
17            fields=[
18                (
19                    "policybindingmodel_ptr",
20                    models.OneToOneField(
21                        auto_created=True,
22                        on_delete=django.db.models.deletion.CASCADE,
23                        parent_link=True,
24                        primary_key=True,
25                        serialize=False,
26                        to="authentik_policies.policybindingmodel",
27                    ),
28                ),
29                ("attributes", models.JSONField(blank=True, default=dict)),
30                ("name", models.TextField()),
31                (
32                    "app",
33                    models.ForeignKey(
34                        on_delete=django.db.models.deletion.CASCADE, to="authentik_core.application"
35                    ),
36                ),
37            ],
38            options={
39                "verbose_name": "Application Entitlement",
40                "verbose_name_plural": "Application Entitlements",
41                "unique_together": {("app", "name")},
42            },
43            bases=("authentik_policies.policybindingmodel", models.Model),
44        ),
45    ]
class Migration(django.db.migrations.migration.Migration):
 8class Migration(migrations.Migration):
 9
10    dependencies = [
11        ("authentik_core", "0040_provider_invalidation_flow"),
12        ("authentik_policies", "0011_policybinding_failure_result_and_more"),
13    ]
14
15    operations = [
16        migrations.CreateModel(
17            name="ApplicationEntitlement",
18            fields=[
19                (
20                    "policybindingmodel_ptr",
21                    models.OneToOneField(
22                        auto_created=True,
23                        on_delete=django.db.models.deletion.CASCADE,
24                        parent_link=True,
25                        primary_key=True,
26                        serialize=False,
27                        to="authentik_policies.policybindingmodel",
28                    ),
29                ),
30                ("attributes", models.JSONField(blank=True, default=dict)),
31                ("name", models.TextField()),
32                (
33                    "app",
34                    models.ForeignKey(
35                        on_delete=django.db.models.deletion.CASCADE, to="authentik_core.application"
36                    ),
37                ),
38            ],
39            options={
40                "verbose_name": "Application Entitlement",
41                "verbose_name_plural": "Application Entitlements",
42                "unique_together": {("app", "name")},
43            },
44            bases=("authentik_policies.policybindingmodel", models.Model),
45        ),
46    ]

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_core', '0040_provider_invalidation_flow'), ('authentik_policies', '0011_policybinding_failure_result_and_more')]
operations = [<CreateModel name='ApplicationEntitlement', fields=[('policybindingmodel_ptr', <django.db.models.fields.related.OneToOneField>), ('attributes', <django.db.models.fields.json.JSONField>), ('name', <django.db.models.fields.TextField>), ('app', <django.db.models.fields.related.ForeignKey>)], options={'verbose_name': 'Application Entitlement', 'verbose_name_plural': 'Application Entitlements', 'unique_together': {('app', 'name')}}, bases=('authentik_policies.policybindingmodel', <class 'django.db.models.base.Model'>)>]