# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-15 15:42
from __future__ import unicode_literals

import uuid
from django.db import migrations, models
import django.db.models.deletion
import vmlog.models


class Migration(migrations.Migration):

    dependencies = [
        ('vmlog', '0002_auto_20160915_1501'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='binaryjitlog',
            name='user',
        ),
        migrations.AlterField(
            model_name='binaryjitlog',
            name='checksum',
            field=models.CharField(max_length=128),
        ),
        migrations.AddField(
            model_name='binaryjitlog',
            name='jitlog_id',
            field=models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False),
        ),
        migrations.AlterField(
            model_name='binaryjitlog',
            name='file',
            field=models.FileField(upload_to=vmlog.models.get_profile_storage_directory),
        ),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-15 15:42
from __future__ import unicode_literals

import uuid
from django.db import migrations, models
import django.db.models.deletion
import vmlog.models

def forward_func(apps, schema_editor):
    BinaryJitLog = apps.get_model("vmlog", "BinaryJitLog")
    for log in BinaryJitLog.objects.all():
        log.jitlog_id = uuid.uuid4()
        log.save()

def backward_func(apps, schema_editor):
    pass

class Migration(migrations.Migration):

    dependencies = [
        ('vmlog', '0002_auto_20160915_1501'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='binaryjitlog',
            name='user',
        ),
        migrations.AlterField(
            model_name='binaryjitlog',
            name='checksum',
            field=models.CharField(max_length=128),
        ),
        migrations.AddField(
            model_name='binaryjitlog',
            name='jitlog_id',
            field=models.CharField(max_length=64, null=True, unique=False),
        ),
        migrations.RunPython(forward_func, backward_func),
        migrations.AlterField(
            model_name='binaryjitlog',
            name='jitlog_id',
            field=models.CharField(max_length=64, primary_key=True, serialize=True),
        ),
        migrations.AlterField(
            model_name='binaryjitlog',
            name='file',
            field=models.FileField(upload_to=vmlog.models.get_profile_storage_directory),
        ),
    ]

add migration that assigns a unique value to the jitlogs