# Generated by Django 5.2.4 on 2025-09-17 00:00

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


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0021_user_operate_as"),
    ]

    operations = [
        migrations.AddField(
            model_name="chatprofile",
            name="group",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="core.securitygroup",
            ),
        ),
        migrations.AddField(
            model_name="odooprofile",
            name="group",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="core.securitygroup",
            ),
        ),
        migrations.AddField(
            model_name="releasemanager",
            name="group",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="core.securitygroup",
            ),
        ),
        migrations.AlterField(
            model_name="chatprofile",
            name="user",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="odooprofile",
            name="user",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="releasemanager",
            name="user",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddConstraint(
            model_name="chatprofile",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    models.Q(("user__isnull", False), ("group__isnull", True)),
                    models.Q(("user__isnull", True), ("group__isnull", False)),
                    _connector="OR",
                ),
                name="chatprofile_requires_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="odooprofile",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    models.Q(("user__isnull", False), ("group__isnull", True)),
                    models.Q(("user__isnull", True), ("group__isnull", False)),
                    _connector="OR",
                ),
                name="odooprofile_requires_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="releasemanager",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    models.Q(("user__isnull", False), ("group__isnull", True)),
                    models.Q(("user__isnull", True), ("group__isnull", False)),
                    _connector="OR",
                ),
                name="releasemanager_requires_owner",
            ),
        ),
    ]
