# Generated by Django 4.2.7 on 2025-12-09 21:02

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("materials", "0001_initial"),
        ("schedule", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="material",
            name="lesson",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="materials",
                to="schedule.lesson",
                verbose_name="Занятие",
            ),
        ),
        migrations.AddField(
            model_name="material",
            name="owner",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="materials",
                to=settings.AUTH_USER_MODEL,
                verbose_name="Владелец",
            ),
        ),
        migrations.AddField(
            model_name="material",
            name="shared_with",
            field=models.ManyToManyField(
                blank=True,
                related_name="shared_materials",
                to=settings.AUTH_USER_MODEL,
                verbose_name="Доступ предоставлен",
            ),
        ),
        migrations.AddField(
            model_name="material",
            name="tags",
            field=models.ManyToManyField(
                blank=True,
                related_name="materials",
                to="materials.materialtag",
                verbose_name="Теги",
            ),
        ),
        migrations.AlterUniqueTogether(
            name="materialfolder",
            unique_together={("owner", "parent", "name")},
        ),
        migrations.AddIndex(
            model_name="materialaccess",
            index=models.Index(
                fields=["material", "created_at"], name="material_ac_materia_076731_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="materialaccess",
            index=models.Index(
                fields=["user", "created_at"], name="material_ac_user_id_af515b_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(
                fields=["owner", "is_deleted"], name="materials_owner_i_c04072_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(
                fields=["folder", "is_deleted"], name="materials_folder__30b976_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(
                fields=["material_type"], name="materials_materia_728bd0_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(
                fields=["access_type", "is_deleted"],
                name="materials_access__5c3073_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(fields=["lesson"], name="materials_lesson__c20660_idx"),
        ),
        migrations.AddIndex(
            model_name="material",
            index=models.Index(
                fields=["homework"], name="materials_homewor_8ed906_idx"
            ),
        ),
    ]
