# Generated by Django 3.2.19 on 2024-07-30 10:07

from django.db import migrations, models

import debusine.artifacts.models
import debusine.db.constraints


class Migration(migrations.Migration):

    dependencies = [
        ('db', '0070_collectionitem_parent_category_data'),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name='collectionitem',
            name='db_collectionitem_unique_debian_environments',
        ),
        migrations.AlterField(
            model_name='collectionitem',
            name='parent_category',
            field=models.CharField(max_length=255),
        ),
        migrations.AddConstraint(
            model_name='collectionitem',
            constraint=debusine.db.constraints.JsonDataUniqueConstraint(
                condition=models.Q(
                    (
                        'parent_category',
                        debusine.artifacts.models.CollectionCategory[
                            'ENVIRONMENTS'
                        ],
                    ),
                    ('removed_at__isnull', True),
                ),
                fields=(
                    'category',
                    "data->>'codename'",
                    "data->>'architecture'",
                    "data->>'variant'",
                    "data->>'backend'",
                    'parent_collection',
                ),
                name='db_collectionitem_unique_debian_environments',
                nulls_distinct=False,
            ),
        ),
    ]
