# Generated by Django 4.2.14 on 2024-08-02 05:48

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("analyzer", "0004_analyzer_task_name_alter_analyzer_host_gremlin"),
    ]

    operations = [
        migrations.AddConstraint(
            model_name="analyzer",
            constraint=models.CheckConstraint(
                check=models.Q(
                    models.Q(
                        ("host_gremlin__isnull", True), ("task_name__isnull", False)
                    ),
                    models.Q(
                        ("host_gremlin__isnull", False), ("task_name__isnull", True)
                    ),
                    _connector="OR",
                ),
                name="one_field_null_constraint",
            ),
        ),
        migrations.AddConstraint(
            model_name="analyzer",
            constraint=models.UniqueConstraint(
                condition=models.Q(("host_gremlin__isnull", False)),
                fields=("host_gremlin",),
                name="unique_host_gremlin_if_not_null",
            ),
        ),
        migrations.AddConstraint(
            model_name="analyzer",
            constraint=models.UniqueConstraint(
                condition=models.Q(("task_name__isnull", False)),
                fields=("task_name",),
                name="unique_task_name_if_not_null",
            ),
        ),
    ]
