# Generated by Django 4.1.9 on 2023-06-30 16:11

from django.db import migrations


def copy_old_data(apps, schema_editor):
    TemplateParamValue = apps.get_model("store", "TemplateParamValue")
    ProductCategoryParamValue = apps.get_model("store", "ProductCategoryParamValue")

    for param_value in TemplateParamValue.objects.all():
        ProductCategoryParamValue.objects.create(
            param=param_value.param,
            value=param_value.value
        )


def remove_new_data(apps, schema_editor):
    ProductCategoryParamValue = apps.get_model("store", "ProductCategoryParamValue")
    ProductCategoryParamValue.objects.all().delete()


class Migration(migrations.Migration):
    dependencies = [
        ("store", "0009_productcategoryparam_order_productcategoryparamvalue"),
    ]

    operations = [
        migrations.RunPython(copy_old_data, remove_new_data),
    ]
