# Generated by Django 3.2.13 on 2023-07-14 12:28

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("assignment", "0002_assignmentcompletionauditlog_assignment_user"),
        ("course", "0001_initial"),
        ("wagtailcore", "0083_workflowcontenttype"),
    ]

    operations = [
        migrations.AddField(
            model_name="assignmentcompletionauditlog",
            name="course_session",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="course.coursesession",
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletionauditlog",
            name="evaluation_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletion",
            name="assignment",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="assignment.assignment"
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletion",
            name="assignment_user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletion",
            name="course_session",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="course.coursesession"
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletion",
            name="evaluation_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="assignmentcompletion",
            name="learning_content_page",
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text="Page reference mostly needed for 'REFLECTION' assignments",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="wagtailcore.page",
            ),
        ),
        migrations.AddConstraint(
            model_name="assignmentcompletion",
            constraint=models.UniqueConstraint(
                fields=(
                    "assignment_user",
                    "assignment",
                    "course_session",
                    "learning_content_page",
                ),
                name="assignment_completion_unique_user_assignment_course_session",
            ),
        ),
    ]
