# Generated by Django 3.2.7 on 2022-04-06 08:02

import django.db.models.deletion
from django.db import migrations, models


def create_other_materialcategory(apps, schema_editor):
    MaterialCategory = apps.get_model("uploaded_material", "MaterialCategory")
    MaterialCategory.objects.create(name="Other")


class Migration(migrations.Migration):

    dependencies = [
        ("uploaded_material", "0003_auto_20220325_1513"),
    ]

    operations = [
        migrations.CreateModel(
            name="MaterialCategory",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Name of the category", max_length=50
                    ),
                ),
            ],
        ),
        migrations.RunPython(
            create_other_materialcategory, migrations.RunPython.noop
        ),
        migrations.AlterField(
            model_name="material",
            name="last_modification_date",
            field=models.DateTimeField(
                help_text="Date when the material has last been modified."
            ),
        ),
        migrations.AddField(
            model_name="material",
            name="category",
            field=models.ForeignKey(
                default=1,
                help_text="The category of the uploaded material.",
                on_delete=django.db.models.deletion.PROTECT,
                to="uploaded_material.materialcategory",
            ),
            preserve_default=False,
        ),
    ]
