# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-12 08:46
from __future__ import unicode_literals

from django.db import migrations, models
from django.db.models import F


def add_default_code(apps, schema_editor):
    """Use id as default code
    """
    Component = apps.get_model('goals', 'Component')
    Component.objects.filter(code='').update(code=F('id'))


def dummy(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('goals', '0043_alter_field_fiscal_year_max_length_on_progress'),
    ]

    operations = [
        migrations.RunPython(add_default_code, reverse_code=dummy),
        migrations.AlterField(
            model_name='component',
            name='code',
            field=models.CharField(max_length=10, unique=True, verbose_name='Component number'),
        ),
    ]
