# Generated by Django 4.2.19 on 2025-03-10 18:20

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

import debusine.tasks.models


class Migration(migrations.Migration):
    dependencies = [
        ('db', '0137_add_groupmembership_role'),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name='worker',
            name='db_worker_celery_or_token',
        ),
        migrations.AddField(
            model_name='token',
            name='expire_at',
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='worker',
            name='activation_token',
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='activating_worker',
                to='db.token',
            ),
        ),
        migrations.AddConstraint(
            model_name='worker',
            constraint=models.CheckConstraint(
                check=models.Q(
                    ('worker_type', debusine.tasks.models.WorkerType['CELERY']),
                    ('activation_token__isnull', False),
                    ('token__isnull', False),
                    _connector='OR',
                ),
                name='db_worker_celery_or_token',
            ),
        ),
    ]
