28 lines
		
	
	
		
			842 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			842 B
		
	
	
	
		
			Python
		
	
	
	
	
	
# Generated by Django 3.1.2 on 2020-10-17 14:26
 | 
						|
 | 
						|
from django.apps.registry import Apps
 | 
						|
from django.db import migrations
 | 
						|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
 | 
						|
 | 
						|
 | 
						|
def fix_missing_token_identifier(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
 | 
						|
    from passbook.outposts.models import Outpost
 | 
						|
 | 
						|
    for outpost in Outpost.objects.using(schema_editor.connection.alias).all():
 | 
						|
        token = outpost.token
 | 
						|
        if token.identifier != outpost.token_identifier:
 | 
						|
            token.identifier = outpost.token_identifier
 | 
						|
            token.save()
 | 
						|
 | 
						|
 | 
						|
class Migration(migrations.Migration):
 | 
						|
 | 
						|
    dependencies = [
 | 
						|
        ("passbook_core", "0014_auto_20201018_1158"),
 | 
						|
        ("passbook_outposts", "0008_auto_20201014_1547"),
 | 
						|
    ]
 | 
						|
 | 
						|
    operations = [
 | 
						|
        migrations.RunPython(fix_missing_token_identifier),
 | 
						|
    ]
 |