# Generated by Django 5.2.8 on 2025-12-06 16:20

from django.db import migrations


OLD_PHASES = 2
NEW_PHASES = 1
TEMPLATE_NAME = "EV Charger"


def update_phases(apps, schema_editor):
    CalculatorTemplate = apps.get_model("awg", "CalculatorTemplate")
    CalculatorTemplate.objects.filter(
        name=TEMPLATE_NAME, phases=OLD_PHASES
    ).update(phases=NEW_PHASES)


def revert_phases(apps, schema_editor):
    CalculatorTemplate = apps.get_model("awg", "CalculatorTemplate")
    CalculatorTemplate.objects.filter(
        name=TEMPLATE_NAME, phases=NEW_PHASES
    ).update(phases=OLD_PHASES)


class Migration(migrations.Migration):

    dependencies = [
        ("awg", "0003_update_ev_charger_description"),
    ]

    operations = [
        migrations.RunPython(update_phases, revert_phases),
    ]
