45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # Generated by Django 3.1.1 on 2020-09-24 16:05
 | |
| 
 | |
| from django.apps.registry import Apps
 | |
| from django.db import migrations, models
 | |
| 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()
 | |
| 
 | |
| 
 | |
| class Migration(migrations.Migration):
 | |
| 
 | |
|     dependencies = [
 | |
|         ("passbook_flows", "0012_auto_20200908_1542"),
 | |
|     ]
 | |
| 
 | |
|     operations = [
 | |
|         migrations.AlterField(
 | |
|             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,
 | |
|             ),
 | |
|         ),
 | |
|         migrations.RunPython(update_flow_designation),
 | |
|     ]
 | 
