# Generated by Django 4.2.dev20221212145044 on 2022-12-12 15:06

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("wagtailcore", "0079_rename_taskstate_page_revision"),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name="workflowstate",
            name="unique_in_progress_workflow",
        ),
        migrations.AlterField(
            model_name="workflowstate",
            name="page",
            field=models.CharField(max_length=255, verbose_name="object id"),
        ),
        migrations.RenameField(
            model_name="workflowstate",
            old_name="page",
            new_name="object_id",
        ),
        migrations.AddField(
            model_name="workflowstate",
            name="content_type",
            field=models.ForeignKey(
                null=True,
                on_delete=models.CASCADE,
                related_name="+",
                to="contenttypes.contenttype",
            ),
        ),
        migrations.AddField(
            model_name="workflowstate",
            name="base_content_type",
            field=models.ForeignKey(
                null=True,
                on_delete=models.CASCADE,
                related_name="+",
                to="contenttypes.contenttype",
            ),
        ),
        migrations.AddIndex(
            model_name="workflowstate",
            index=models.Index(
                fields=["content_type", "object_id"],
                name="workflowstate_ct_id_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="workflowstate",
            index=models.Index(
                fields=["base_content_type", "object_id"],
                name="workflowstate_base_ct_id_idx",
            ),
        ),
        migrations.AddConstraint(
            model_name="workflowstate",
            constraint=models.UniqueConstraint(
                condition=models.Q(("status__in", ("in_progress", "needs_changes"))),
                fields=("base_content_type", "object_id"),
                name="unique_in_progress_workflow",
            ),
        ),
    ]
