# Generated by Django 4.2.14 on 2024-08-02 04:56

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


class Migration(migrations.Migration):

    dependencies = [
        ("analyzer", "0004_analyzer_task_name_alter_analyzer_host_gremlin"),
        ("extracts", "0013_alter_column_user_lock_alter_datacell_user_lock_and_more"),
        ("documents", "0007_alter_document_user_lock_documentanalysisrow_and_more"),
    ]

    operations = [
        migrations.AddField(
            model_name="documentanalysisrow",
            name="analysis",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="rows",
                to="analyzer.analysis",
            ),
        ),
        migrations.AddField(
            model_name="documentanalysisrow",
            name="extract",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="rows",
                to="extracts.extract",
            ),
        ),
        migrations.AddConstraint(
            model_name="documentanalysisrow",
            constraint=models.UniqueConstraint(
                condition=models.Q(("analysis__isnull", False)),
                fields=("document", "analysis"),
                name="unique_document_analysis",
            ),
        ),
        migrations.AddConstraint(
            model_name="documentanalysisrow",
            constraint=models.UniqueConstraint(
                condition=models.Q(("extract__isnull", False)),
                fields=("document", "extract"),
                name="unique_document_extract",
            ),
        ),
    ]
