# 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 = [
        ("schedule", "0001_initial"),
        ("homework", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="homework",
            name="lesson",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="homeworks",
                to="schedule.lesson",
                verbose_name="Занятие",
            ),
        ),
        migrations.AddField(
            model_name="homework",
            name="mentor",
            field=models.ForeignKey(
                limit_choices_to={"role": "mentor"},
                on_delete=django.db.models.deletion.CASCADE,
                related_name="created_homeworks",
                to=settings.AUTH_USER_MODEL,
                verbose_name="Ментор",
            ),
        ),
        migrations.AddIndex(
            model_name="homeworksubmission",
            index=models.Index(
                fields=["homework", "student"], name="homework_su_homewor_583d50_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="homeworksubmission",
            index=models.Index(
                fields=["student", "status"], name="homework_su_student_edd8aa_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="homeworksubmission",
            index=models.Index(
                fields=["status", "submitted_at"], name="homework_su_status_2b19af_idx"
            ),
        ),
        migrations.AlterUniqueTogether(
            name="homeworksubmission",
            unique_together={("homework", "student", "attempt_number")},
        ),
        migrations.AddIndex(
            model_name="homework",
            index=models.Index(
                fields=["mentor", "status"], name="homeworks_mentor__756b56_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="homework",
            index=models.Index(fields=["lesson"], name="homeworks_lesson__a3dbd5_idx"),
        ),
        migrations.AddIndex(
            model_name="homework",
            index=models.Index(
                fields=["deadline"], name="homeworks_deadlin_031a21_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="homework",
            index=models.Index(
                fields=["status", "published_at"], name="homeworks_status_64d19b_idx"
            ),
        ),
    ]
