# Generated by Django 4.2.28 on 2026-06-04 16:44

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


class Migration(migrations.Migration):
    dependencies = [
        ('db', '0059_workflowtemplate_extra_groups'),
    ]

    operations = [
        migrations.CreateModel(
            name='CollectionRole',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'role',
                    models.CharField(
                        choices=[('owner', 'Owner'), ('viewer', 'Viewer')],
                        max_length=16,
                    ),
                ),
                (
                    'group',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='collection_roles',
                        to='db.group',
                    ),
                ),
                (
                    'resource',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='roles',
                        to='db.collection',
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name='collectionrole',
            constraint=models.UniqueConstraint(
                fields=('resource', 'group', 'role'),
                name='db_collectionrole_unique_resource_group_role',
            ),
        ),
    ]
