# Generated by Django 4.0.5 on 2023-02-02 00:34

from django.db import migrations


def move_from_seconds_to_microseconds(apps, schema_editor):
    SubscriptionRecord = apps.get_model("metering_billing", "SubscriptionRecord")
    for row in SubscriptionRecord.objects.all():
        row.unadjusted_duration_microseconds = row.unadjusted_duration_seconds * 10**6
        row.save()


class Migration(migrations.Migration):
    dependencies = [
        (
            "metering_billing",
            "0172_remove_historicalsubscriptionrecord_unadjusted_duration_seconds_and_more",
        ),
    ]

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