2020-09-24 18:05:49 +00:00
|
|
|
# Generated by Django 3.1.1 on 2020-09-24 16:05
|
|
|
|
|
2020-09-25 10:43:11 +00:00
|
|
|
from django.apps.registry import Apps
|
2020-09-24 18:05:49 +00:00
|
|
|
from django.db import migrations, models
|
2020-09-25 10:43:11 +00:00
|
|
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
|
|
|
|
|
|
|
from passbook.flows.models import FlowDesignation
|
|
|
|
|
|
|
|
|
|
|
|
def update_flow_designation(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
|
|
|
|
Flow = apps.get_model("passbook_flows", "Flow")
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
|
|
|
|
for flow in Flow.objects.using(db_alias).all():
|
|
|
|
if flow.designation == "stage_setup":
|
|
|
|
flow.designation = FlowDesignation.STAGE_CONFIGURATION
|
|
|
|
flow.save()
|
2020-09-24 18:05:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
2020-09-25 10:43:11 +00:00
|
|
|
("passbook_flows", "0012_auto_20200908_1542"),
|
2020-09-24 18:05:49 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.AlterField(
|
2020-09-25 10:43:11 +00:00
|
|
|
model_name="flow",
|
|
|
|
name="designation",
|
|
|
|
field=models.CharField(
|
|
|
|
choices=[
|
|
|
|
("authentication", "Authentication"),
|
|
|
|
("authorization", "Authorization"),
|
|
|
|
("invalidation", "Invalidation"),
|
|
|
|
("enrollment", "Enrollment"),
|
|
|
|
("unenrollment", "Unrenollment"),
|
|
|
|
("recovery", "Recovery"),
|
|
|
|
("stage_configuration", "Stage Configuration"),
|
|
|
|
],
|
|
|
|
max_length=100,
|
|
|
|
),
|
2020-09-24 18:05:49 +00:00
|
|
|
),
|
2020-09-25 10:43:11 +00:00
|
|
|
migrations.RunPython(update_flow_designation),
|
2020-09-24 18:05:49 +00:00
|
|
|
]
|