# Generated by Django 5.2.9 on 2026-01-20 18:46

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("documents", "0001_initial"),
        ("paperless_mail", "0001_initial"),
    ]

    operations = [
        migrations.AddField(
            model_name="workflowtrigger",
            name="filter_mailrule",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="paperless_mail.mailrule",
                verbose_name="filter documents from this mail rule",
            ),
        ),
        migrations.AddField(
            model_name="workflowtrigger",
            name="schedule_date_custom_field",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="documents.customfield",
                verbose_name="schedule date custom field",
            ),
        ),
        migrations.AddField(
            model_name="workflow",
            name="triggers",
            field=models.ManyToManyField(
                related_name="workflows",
                to="documents.workflowtrigger",
                verbose_name="triggers",
            ),
        ),
        migrations.AddConstraint(
            model_name="correspondent",
            constraint=models.UniqueConstraint(
                fields=("name", "owner"),
                name="documents_correspondent_unique_name_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="correspondent",
            constraint=models.UniqueConstraint(
                condition=models.Q(("owner__isnull", True)),
                fields=("name",),
                name="documents_correspondent_name_uniq",
            ),
        ),
        migrations.AddConstraint(
            model_name="customfieldinstance",
            constraint=models.UniqueConstraint(
                fields=("document", "field"),
                name="documents_customfieldinstance_unique_document_field",
            ),
        ),
        migrations.AddConstraint(
            model_name="documenttype",
            constraint=models.UniqueConstraint(
                fields=("name", "owner"),
                name="documents_documenttype_unique_name_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="documenttype",
            constraint=models.UniqueConstraint(
                condition=models.Q(("owner__isnull", True)),
                fields=("name",),
                name="documents_documenttype_name_uniq",
            ),
        ),
        migrations.AddConstraint(
            model_name="storagepath",
            constraint=models.UniqueConstraint(
                fields=("name", "owner"),
                name="documents_storagepath_unique_name_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="storagepath",
            constraint=models.UniqueConstraint(
                condition=models.Q(("owner__isnull", True)),
                fields=("name",),
                name="documents_storagepath_name_uniq",
            ),
        ),
        migrations.AddConstraint(
            model_name="tag",
            constraint=models.UniqueConstraint(
                fields=("name", "owner"),
                name="documents_tag_unique_name_owner",
            ),
        ),
        migrations.AddConstraint(
            model_name="tag",
            constraint=models.UniqueConstraint(
                condition=models.Q(("owner__isnull", True)),
                fields=("name",),
                name="documents_tag_name_uniq",
            ),
        ),
    ]
