# Generated by Django 4.2.20 on 2025-05-27 11:54

from django.db import migrations, models

import debusine.artifacts.models


class Migration(migrations.Migration):
    dependencies = [
        ('db', '0008_collectionitem_db_ci_name_idx'),
    ]
    replaces = [
        ('db', '0150_add_archive_singleton_collection'),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name='collection',
            name='db_collection_name_not_reserved',
        ),
        migrations.AddConstraint(
            model_name='collection',
            constraint=models.CheckConstraint(
                check=models.Q(
                    models.Q(
                        models.Q(
                            (
                                'category__in',
                                [
                                    debusine.artifacts.models.CollectionCategory[
                                        'ARCHIVE'
                                    ],
                                    debusine.artifacts.models.CollectionCategory[
                                        'PACKAGE_BUILD_LOGS'
                                    ],
                                    debusine.artifacts.models.CollectionCategory[
                                        'TASK_HISTORY'
                                    ],
                                ],
                            ),
                            _negated=True,
                        ),
                        models.Q(('name__startswith', '_'), _negated=True),
                    ),
                    models.Q(
                        (
                            'category__in',
                            [
                                debusine.artifacts.models.CollectionCategory[
                                    'ARCHIVE'
                                ],
                                debusine.artifacts.models.CollectionCategory[
                                    'PACKAGE_BUILD_LOGS'
                                ],
                                debusine.artifacts.models.CollectionCategory[
                                    'TASK_HISTORY'
                                ],
                            ],
                        ),
                        ('name', '_'),
                    ),
                    _connector='OR',
                ),
                name='db_collection_name_not_reserved',
            ),
        ),
    ]
