# Generated by Django 2.2.11 on 2022-04-21 20:08
import uuid

from django.db import migrations, models

import care.facility.models.asset


def populate_empty_qr_code_id(apps, schema_editor):
    Asset = apps.get_model("facility", "Asset")
    for asset in Asset.objects.all():
        asset.qr_code_id = uuid.uuid4()
        asset.save()


class Migration(migrations.Migration):
    dependencies = [
        ("facility", "0286_auto_20220316_2004"),
    ]

    operations = [
        migrations.AddField(
            model_name="asset",
            name="qr_code_id",
            field=models.CharField(
                blank=True,
                default=care.facility.models.asset.get_random_asset_id,
                max_length=1024,
            ),
        ),
        migrations.RunPython(populate_empty_qr_code_id, migrations.RunPython.noop),
    ]
