# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-04 22:15
from __future__ import unicode_literals

from django.db import migrations, models
import uuid


def create_ids(apps, schema_editor):
    Launch = apps.get_model('api', 'Launch')
    for m in Launch.objects.all():
        m.new_id = uuid.uuid4()
        m.save()

def remove_ids(apps, schema_editor):
    Launch = apps.get_model('api', 'Launch')
    for m in Launch.objects.all():
        m.uuid = None
        m.save()


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0019_auto_20181206_0135'),
    ]

    operations = [
        migrations.AddField(
            model_name='launch',
            name='new_id',
            field=models.UUIDField(default=uuid.uuid4),
        ),
        migrations.RunPython(code=create_ids, reverse_code=remove_ids),
    ]
