authentik.enterprise.lifecycle.migrations.0004_lifecyclerulenotificationtransport_and_more

  1# Generated by Django 5.2.15 on 2026-06-23 15:35
  2
  3import django.db.models.deletion
  4from django.conf import settings
  5from django.db import migrations, models
  6
  7
  8class Migration(migrations.Migration):
  9
 10    dependencies = [
 11        ("authentik_core", "0060_sourcegrouppropertymapping_and_more"),
 12        ("authentik_events", "0019_notificationrulenotificationtransport_and_more"),
 13        (
 14            "authentik_lifecycle",
 15            "0003_remove_lifecyclerule_uniq_lifecycle_rule_ct_null_object_and_more",
 16        ),
 17        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
 18    ]
 19
 20    operations = [
 21        migrations.SeparateDatabaseAndState(
 22            database_operations=[],
 23            state_operations=[
 24                migrations.CreateModel(
 25                    name="LifecycleRuleReviewerGroup",
 26                    fields=[
 27                        (
 28                            "id",
 29                            models.AutoField(
 30                                auto_created=True,
 31                                primary_key=True,
 32                                serialize=False,
 33                                verbose_name="ID",
 34                            ),
 35                        ),
 36                        (
 37                            "group",
 38                            models.ForeignKey(
 39                                on_delete=django.db.models.deletion.CASCADE,
 40                                to="authentik_core.group",
 41                            ),
 42                        ),
 43                        (
 44                            "lifecycle_rule",
 45                            models.ForeignKey(
 46                                db_column="lifecyclerule_id",
 47                                on_delete=django.db.models.deletion.CASCADE,
 48                                to="authentik_lifecycle.lifecyclerule",
 49                            ),
 50                        ),
 51                    ],
 52                    options={
 53                        "db_table": "authentik_lifecycle_lifecyclerule_reviewer_groups",
 54                        "unique_together": {("lifecycle_rule", "group")},
 55                        "verbose_name": "Lifecycle Rule Reviewer Group",
 56                        "verbose_name_plural": "Lifecycle Rule Reviewer Groups",
 57                    },
 58                ),
 59                migrations.AlterField(
 60                    model_name="lifecyclerule",
 61                    name="reviewer_groups",
 62                    field=models.ManyToManyField(
 63                        blank=True,
 64                        through="authentik_lifecycle.LifecycleRuleReviewerGroup",
 65                        to="authentik_core.group",
 66                    ),
 67                ),
 68            ],
 69        ),
 70        migrations.SeparateDatabaseAndState(
 71            database_operations=[],
 72            state_operations=[
 73                migrations.CreateModel(
 74                    name="LifecycleRuleReviewer",
 75                    fields=[
 76                        (
 77                            "id",
 78                            models.AutoField(
 79                                auto_created=True,
 80                                primary_key=True,
 81                                serialize=False,
 82                                verbose_name="ID",
 83                            ),
 84                        ),
 85                        (
 86                            "lifecycle_rule",
 87                            models.ForeignKey(
 88                                db_column="lifecyclerule_id",
 89                                on_delete=django.db.models.deletion.CASCADE,
 90                                to="authentik_lifecycle.lifecyclerule",
 91                            ),
 92                        ),
 93                        (
 94                            "user",
 95                            models.ForeignKey(
 96                                on_delete=django.db.models.deletion.CASCADE,
 97                                to=settings.AUTH_USER_MODEL,
 98                            ),
 99                        ),
100                    ],
101                    options={
102                        "db_table": "authentik_lifecycle_lifecyclerule_reviewers",
103                        "unique_together": {("lifecycle_rule", "user")},
104                        "verbose_name": "Lifecycle Rule Reviewer",
105                        "verbose_name_plural": "Lifecycle Rule Reviewers",
106                    },
107                ),
108                migrations.AlterField(
109                    model_name="lifecyclerule",
110                    name="reviewers",
111                    field=models.ManyToManyField(
112                        blank=True,
113                        through="authentik_lifecycle.LifecycleRuleReviewer",
114                        to=settings.AUTH_USER_MODEL,
115                    ),
116                ),
117            ],
118        ),
119        migrations.SeparateDatabaseAndState(
120            database_operations=[],
121            state_operations=[
122                migrations.CreateModel(
123                    name="LifecycleRuleNotificationTransport",
124                    fields=[
125                        (
126                            "id",
127                            models.AutoField(
128                                auto_created=True,
129                                primary_key=True,
130                                serialize=False,
131                                verbose_name="ID",
132                            ),
133                        ),
134                        (
135                            "lifecycle_rule",
136                            models.ForeignKey(
137                                db_column="lifecyclerule_id",
138                                on_delete=django.db.models.deletion.CASCADE,
139                                to="authentik_lifecycle.lifecyclerule",
140                            ),
141                        ),
142                        (
143                            "notification_transport",
144                            models.ForeignKey(
145                                db_column="notificationtransport_id",
146                                on_delete=django.db.models.deletion.CASCADE,
147                                to="authentik_events.notificationtransport",
148                            ),
149                        ),
150                    ],
151                    options={
152                        "db_table": "authentik_lifecycle_lifecyclerule_notification_transports",
153                        "unique_together": {("lifecycle_rule", "notification_transport")},
154                        "verbose_name": "Lifecycle Rule Notification Transport",
155                        "verbose_name_plural": "Lifecycle Rule Notification Transports",
156                    },
157                ),
158                migrations.AlterField(
159                    model_name="lifecyclerule",
160                    name="notification_transports",
161                    field=models.ManyToManyField(
162                        blank=True,
163                        help_text="Select which transports should be used to notify the reviewers. If none are selected, the notification will only be shown in the authentik UI.",
164                        through="authentik_lifecycle.LifecycleRuleNotificationTransport",
165                        to="authentik_events.notificationtransport",
166                    ),
167                ),
168            ],
169        ),
170    ]
class Migration(django.db.migrations.migration.Migration):
  9class Migration(migrations.Migration):
 10
 11    dependencies = [
 12        ("authentik_core", "0060_sourcegrouppropertymapping_and_more"),
 13        ("authentik_events", "0019_notificationrulenotificationtransport_and_more"),
 14        (
 15            "authentik_lifecycle",
 16            "0003_remove_lifecyclerule_uniq_lifecycle_rule_ct_null_object_and_more",
 17        ),
 18        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
 19    ]
 20
 21    operations = [
 22        migrations.SeparateDatabaseAndState(
 23            database_operations=[],
 24            state_operations=[
 25                migrations.CreateModel(
 26                    name="LifecycleRuleReviewerGroup",
 27                    fields=[
 28                        (
 29                            "id",
 30                            models.AutoField(
 31                                auto_created=True,
 32                                primary_key=True,
 33                                serialize=False,
 34                                verbose_name="ID",
 35                            ),
 36                        ),
 37                        (
 38                            "group",
 39                            models.ForeignKey(
 40                                on_delete=django.db.models.deletion.CASCADE,
 41                                to="authentik_core.group",
 42                            ),
 43                        ),
 44                        (
 45                            "lifecycle_rule",
 46                            models.ForeignKey(
 47                                db_column="lifecyclerule_id",
 48                                on_delete=django.db.models.deletion.CASCADE,
 49                                to="authentik_lifecycle.lifecyclerule",
 50                            ),
 51                        ),
 52                    ],
 53                    options={
 54                        "db_table": "authentik_lifecycle_lifecyclerule_reviewer_groups",
 55                        "unique_together": {("lifecycle_rule", "group")},
 56                        "verbose_name": "Lifecycle Rule Reviewer Group",
 57                        "verbose_name_plural": "Lifecycle Rule Reviewer Groups",
 58                    },
 59                ),
 60                migrations.AlterField(
 61                    model_name="lifecyclerule",
 62                    name="reviewer_groups",
 63                    field=models.ManyToManyField(
 64                        blank=True,
 65                        through="authentik_lifecycle.LifecycleRuleReviewerGroup",
 66                        to="authentik_core.group",
 67                    ),
 68                ),
 69            ],
 70        ),
 71        migrations.SeparateDatabaseAndState(
 72            database_operations=[],
 73            state_operations=[
 74                migrations.CreateModel(
 75                    name="LifecycleRuleReviewer",
 76                    fields=[
 77                        (
 78                            "id",
 79                            models.AutoField(
 80                                auto_created=True,
 81                                primary_key=True,
 82                                serialize=False,
 83                                verbose_name="ID",
 84                            ),
 85                        ),
 86                        (
 87                            "lifecycle_rule",
 88                            models.ForeignKey(
 89                                db_column="lifecyclerule_id",
 90                                on_delete=django.db.models.deletion.CASCADE,
 91                                to="authentik_lifecycle.lifecyclerule",
 92                            ),
 93                        ),
 94                        (
 95                            "user",
 96                            models.ForeignKey(
 97                                on_delete=django.db.models.deletion.CASCADE,
 98                                to=settings.AUTH_USER_MODEL,
 99                            ),
100                        ),
101                    ],
102                    options={
103                        "db_table": "authentik_lifecycle_lifecyclerule_reviewers",
104                        "unique_together": {("lifecycle_rule", "user")},
105                        "verbose_name": "Lifecycle Rule Reviewer",
106                        "verbose_name_plural": "Lifecycle Rule Reviewers",
107                    },
108                ),
109                migrations.AlterField(
110                    model_name="lifecyclerule",
111                    name="reviewers",
112                    field=models.ManyToManyField(
113                        blank=True,
114                        through="authentik_lifecycle.LifecycleRuleReviewer",
115                        to=settings.AUTH_USER_MODEL,
116                    ),
117                ),
118            ],
119        ),
120        migrations.SeparateDatabaseAndState(
121            database_operations=[],
122            state_operations=[
123                migrations.CreateModel(
124                    name="LifecycleRuleNotificationTransport",
125                    fields=[
126                        (
127                            "id",
128                            models.AutoField(
129                                auto_created=True,
130                                primary_key=True,
131                                serialize=False,
132                                verbose_name="ID",
133                            ),
134                        ),
135                        (
136                            "lifecycle_rule",
137                            models.ForeignKey(
138                                db_column="lifecyclerule_id",
139                                on_delete=django.db.models.deletion.CASCADE,
140                                to="authentik_lifecycle.lifecyclerule",
141                            ),
142                        ),
143                        (
144                            "notification_transport",
145                            models.ForeignKey(
146                                db_column="notificationtransport_id",
147                                on_delete=django.db.models.deletion.CASCADE,
148                                to="authentik_events.notificationtransport",
149                            ),
150                        ),
151                    ],
152                    options={
153                        "db_table": "authentik_lifecycle_lifecyclerule_notification_transports",
154                        "unique_together": {("lifecycle_rule", "notification_transport")},
155                        "verbose_name": "Lifecycle Rule Notification Transport",
156                        "verbose_name_plural": "Lifecycle Rule Notification Transports",
157                    },
158                ),
159                migrations.AlterField(
160                    model_name="lifecyclerule",
161                    name="notification_transports",
162                    field=models.ManyToManyField(
163                        blank=True,
164                        help_text="Select which transports should be used to notify the reviewers. If none are selected, the notification will only be shown in the authentik UI.",
165                        through="authentik_lifecycle.LifecycleRuleNotificationTransport",
166                        to="authentik_events.notificationtransport",
167                    ),
168                ),
169            ],
170        ),
171    ]

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', '0060_sourcegrouppropertymapping_and_more'), ('authentik_events', '0019_notificationrulenotificationtransport_and_more'), ('authentik_lifecycle', '0003_remove_lifecyclerule_uniq_lifecycle_rule_ct_null_object_and_more'), ('authentik_core', '__first__')]
operations = [<SeparateDatabaseAndState database_operations=[], state_operations=[<CreateModel name='LifecycleRuleReviewerGroup', fields=[('id', <django.db.models.fields.AutoField>), ('group', <django.db.models.fields.related.ForeignKey>), ('lifecycle_rule', <django.db.models.fields.related.ForeignKey>)], options={'db_table': 'authentik_lifecycle_lifecyclerule_reviewer_groups', 'unique_together': {('lifecycle_rule', 'group')}, 'verbose_name': 'Lifecycle Rule Reviewer Group', 'verbose_name_plural': 'Lifecycle Rule Reviewer Groups'}>, <AlterField model_name='lifecyclerule', name='reviewer_groups', field=<django.db.models.fields.related.ManyToManyField>>]>, <SeparateDatabaseAndState database_operations=[], state_operations=[<CreateModel name='LifecycleRuleReviewer', fields=[('id', <django.db.models.fields.AutoField>), ('lifecycle_rule', <django.db.models.fields.related.ForeignKey>), ('user', <django.db.models.fields.related.ForeignKey>)], options={'db_table': 'authentik_lifecycle_lifecyclerule_reviewers', 'unique_together': {('lifecycle_rule', 'user')}, 'verbose_name': 'Lifecycle Rule Reviewer', 'verbose_name_plural': 'Lifecycle Rule Reviewers'}>, <AlterField model_name='lifecyclerule', name='reviewers', field=<django.db.models.fields.related.ManyToManyField>>]>, <SeparateDatabaseAndState database_operations=[], state_operations=[<CreateModel name='LifecycleRuleNotificationTransport', fields=[('id', <django.db.models.fields.AutoField>), ('lifecycle_rule', <django.db.models.fields.related.ForeignKey>), ('notification_transport', <django.db.models.fields.related.ForeignKey>)], options={'db_table': 'authentik_lifecycle_lifecyclerule_notification_transports', 'unique_together': {('lifecycle_rule', 'notification_transport')}, 'verbose_name': 'Lifecycle Rule Notification Transport', 'verbose_name_plural': 'Lifecycle Rule Notification Transports'}>, <AlterField model_name='lifecyclerule', name='notification_transports', field=<django.db.models.fields.related.ManyToManyField>>]>]