# Generated by Django 3.2.18 on 2023-04-13 18:41

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


def copy_email_to_username(apps, schema):
    User = apps.get_model("auth", "User")
    User.objects.exclude(email="").exclude(email__isnull=True).exclude(email=F("username")).update(username=F("email"))


class Migration(migrations.Migration):

    dependencies = [
        ("common", "0038_delete_emailverification"),
    ]

    operations = [
        migrations.RunPython(
            code=copy_email_to_username, reverse_code=migrations.RunPython.noop
        )
    ]

