# Generated by Django 2.0 on 2018-03-27 15:54

import uuid

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


def gen_unique_keys(apps, schema_editor):
    UserProfile = apps.get_model("events", "UserProfile")
    for profile in UserProfile.objects.all():
        profile.secret_key = uuid.uuid4()
        profile.save()


class Migration(migrations.Migration):

    dependencies = [("events", "0020_add_event_comments")]

    operations = [
        migrations.AddField(
            model_name="userprofile",
            name="secret_key",
            field=models.UUIDField(default=uuid.uuid4),
        ),
        migrations.RunPython(gen_unique_keys, reverse_code=migrations.RunPython.noop),
        migrations.AlterField(
            model_name="eventcomment",
            name="event",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="comments",
                to="events.Event",
            ),
        ),
    ]
