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

from vbv_lernwelt.core.model_utils import migrate_avatars


class Migration(migrations.Migration):
    dependencies = [
        ("media_files", "0001_initial"),
        ("core", "0003_organisations"),
    ]

    operations = [
        migrations.AddField(
            model_name="user",
            name="avatar",
            field=models.ForeignKey(
                blank=True,
                help_text="Avatar image for the user",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="media_files.userimage",
            ),
        ),
        migrations.RunPython(migrate_avatars),
        migrations.RemoveField(
            model_name="user",
            name="avatar_url",
        ),
    ]
