# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-26 07:38
from __future__ import unicode_literals

from django.db import migrations


def migrate_files(apps, schema_editor):
    Application = apps.get_model('project', 'Application')
    CommonFile = apps.get_model('common', 'CommonFile')

    for app in Application.objects.all():
        if app.cn.name:
            common_file = CommonFile.objects.create(file_field=app.cn)
            app.cn_fk = common_file
            app.save()

def reverse_func(apps, schema_editor):
    pass

class Migration(migrations.Migration):

    dependencies = [
        ('project', '0032_application_cn_fk'),
    ]

    operations = [
        migrations.RunPython(migrate_files, reverse_func),
    ]
