# Generated by Django 4.0.8 on 2025-07-22 13:13

from django.db import migrations, transaction
import uuid


def gen_uuid(apps, schema_editor):
    UserListItem = apps.get_model("social", "UserListItem")
    while UserListItem.objects.filter(uuid__isnull=True).exists():
        print(UserListItem.objects.filter(uuid__isnull=True).count(), 'rows left')
        with transaction.atomic():
            for row in UserListItem.objects.filter(uuid__isnull=True)[:1000]:
                row.uuid = uuid.uuid4()
                row.save(update_fields=["uuid"])


class Migration(migrations.Migration):
    atomic = False

    dependencies = [
        ('social', '0022_userlist_reported_timestamp_and_more'),
    ]

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