# Generated by Django 4.0.5 on 2023-03-12 00:23

import uuid

from django.db import migrations


def make_unique_uuids(apps, schema_editor):
    PlanComponent = apps.get_model("metering_billing", "PlanComponent")
    RecurringCharge = apps.get_model("metering_billing", "RecurringCharge")
    for plan_component in PlanComponent.objects.all():
        plan_component.usage_component_id = uuid.uuid4()
        plan_component.save()
    for recurring_charge in RecurringCharge.objects.all():
        recurring_charge.recurring_charge_id = uuid.uuid4()
        recurring_charge.save()


class Migration(migrations.Migration):
    dependencies = [
        (
            "metering_billing",
            "0206_customer_created_historicalcustomer_created_and_more",
        ),
    ]

    operations = [
        migrations.RunPython(make_unique_uuids),
    ]
