# Generated by Django 4.2.24 on 2025-11-01 16:05

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("badges", "0001_initial"),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name="userbadge",
            name="unique_user_badge_corpus",
        ),
        migrations.AddConstraint(
            model_name="userbadge",
            constraint=models.UniqueConstraint(
                condition=models.Q(("corpus__isnull", True)),
                fields=("user", "badge"),
                name="unique_user_badge_global",
            ),
        ),
        migrations.AddConstraint(
            model_name="userbadge",
            constraint=models.UniqueConstraint(
                condition=models.Q(("corpus__isnull", False)),
                fields=("user", "badge", "corpus"),
                name="unique_user_badge_corpus",
            ),
        ),
    ]
