# Generated by Django 5.0.9 on 2024-11-06 13:31

from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("directory", "0009_remove_entry_external_identfier_and_more"),
        ("wbcommission", "0006_commissionrule_consider_zero_percent_for_exclusion"),
        ("wbcrm", "0013_account_action_plan_account_relationship_status_and_more"),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name="commission",
            name="unique_crm_recipient_account",
        ),
        migrations.RemoveConstraint(
            model_name="commission",
            name="unique_portfolio_role_recipient_account",
        ),
        migrations.RemoveConstraint(
            model_name="commission",
            name="unique_account_role_type_recipient_account",
        ),
        migrations.AddConstraint(
            model_name="commission",
            constraint=models.UniqueConstraint(
                condition=models.Q(("crm_recipient__isnull", False)),
                fields=("commission_type", "account", "crm_recipient"),
                name="unique_crm_recipient_account",
            ),
        ),
        migrations.AddConstraint(
            model_name="commission",
            constraint=models.UniqueConstraint(
                condition=models.Q(("portfolio_role_recipient__isnull", False)),
                fields=("commission_type", "account", "portfolio_role_recipient"),
                name="unique_portfolio_role_recipient_account",
            ),
        ),
        migrations.AddConstraint(
            model_name="commission",
            constraint=models.UniqueConstraint(
                condition=models.Q(("account_role_type_recipient__isnull", False)),
                fields=("commission_type", "account", "account_role_type_recipient"),
                name="unique_account_role_type_recipient_account",
            ),
        ),
    ]
