# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-17 20:19
from __future__ import unicode_literals

from django.db import migrations

def link_person_model(apps, schema_editor):
    Person = apps.get_model('competition', 'Person')
    for person in Person.objects.all():
        person.clubassociation_set.update(person_uuid=person.uuid)
        person.teamassociation_set.update(person_uuid=person.uuid)
        person.seasonassociation_set.update(person_uuid=person.uuid)
        person.statistics.update(player_uuid=person.uuid)


class Migration(migrations.Migration):

    dependencies = [
        ('competition', '0020_competition__add__person_uuid'),
    ]

    operations = [
		migrations.RunPython(
            link_person_model, reverse_code=migrations.RunPython.noop),
    ]

Add data migration to build ForeignKey on Person.uuid field