# Generated by Django 6.0 on 2026-03-04 23:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('academics', '0001_initial'),
        ('staff', '0001_initial'),
        ('students', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='attendance',
            name='marked_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='attendance_marked', to='staff.staff'),
        ),
        migrations.AddField(
            model_name='attendance',
            name='student',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attendances', to='students.student'),
        ),
        migrations.AddField(
            model_name='classsubject',
            name='teacher',
            field=models.ForeignKey(blank=True, limit_choices_to={'role__in': ['teacher', 'class_teacher', 'subject_teacher']}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taught_subjects', to='staff.staff'),
        ),
        migrations.AddField(
            model_name='schoolclass',
            name='class_teacher',
            field=models.ForeignKey(blank=True, limit_choices_to={'role__in': ['teacher', 'class_teacher']}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='classes_as_teacher', to='staff.staff'),
        ),
        migrations.AddField(
            model_name='classsubject',
            name='school_class',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='class_subjects', to='academics.schoolclass'),
        ),
        migrations.AddField(
            model_name='attendance',
            name='school_class',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attendances', to='academics.schoolclass'),
        ),
        migrations.AddField(
            model_name='classsubject',
            name='subject',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='class_subjects', to='academics.subject'),
        ),
        migrations.AddIndex(
            model_name='schoolclass',
            index=models.Index(fields=['code'], name='academics_s_code_3e2002_idx'),
        ),
        migrations.AddIndex(
            model_name='schoolclass',
            index=models.Index(fields=['level'], name='academics_s_level_3e09a8_idx'),
        ),
        migrations.AddIndex(
            model_name='schoolclass',
            index=models.Index(fields=['section_type'], name='academics_s_section_09eebc_idx'),
        ),
        migrations.AddIndex(
            model_name='attendance',
            index=models.Index(fields=['date'], name='academics_a_date_622e79_idx'),
        ),
        migrations.AddIndex(
            model_name='attendance',
            index=models.Index(fields=['student', 'date'], name='academics_a_student_ec0522_idx'),
        ),
        migrations.AddIndex(
            model_name='attendance',
            index=models.Index(fields=['school_class', 'date'], name='academics_a_school__63f677_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='attendance',
            unique_together={('student', 'date', 'period')},
        ),
        migrations.AlterUniqueTogether(
            name='classsubject',
            unique_together={('school_class', 'subject')},
        ),
    ]
