# Generated by Django 3.1.1 on 2020-09-14 13:29

from django.db import migrations


def create_root_category(apps, schema_editor):
    # Create root category
    Category = apps.get_model("product_info_management", "Category")
    db_alias = schema_editor.connection.alias
    Category.objects.using(db_alias).create(name='Root')


def reverse_root_category_creation(apps, schema_editor):
    Category = apps.get_model("product_info_management", "Category")
    db_alias = schema_editor.connection.alias
    Category.objects.using(db_alias).filter(name='Root').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('product_info_management', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_root_category, reverse_code=reverse_root_category_creation)
    ]
