# Generated by Django 4.2.15 on 2024-11-06 08:41

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


class Migration(migrations.Migration):

    dependencies = [
        ('db', '0084_remove_label_label_unique_name_project_when_deleted_at_null_and_more'),
    ]

    operations = [
        migrations.RenameModel(
            old_name="Inbox",
            new_name="Intake",
        ),
        migrations.AlterModelTable(
            name="Intake",
            table="intakes",
        ),
        migrations.AlterModelOptions(
            name="Intake",
            options={
                "verbose_name": "Intake",
                "verbose_name_plural": "Intakes",
                "ordering": ("name",),
            },
        ),
        migrations.AlterField(
            model_name="Intake",
            name="description",
            field=models.TextField(
                blank=True, verbose_name="Intake Description"
            ),
        ),
        migrations.RenameModel(
            old_name="InboxIssue",
            new_name="IntakeIssue",
        ),
        # Rename the 'inbox' field to 'intake'
        migrations.RenameField(
            model_name="IntakeIssue",
            old_name="inbox",
            new_name="intake",
        ),
        # Update ForeignKey related_name for 'intake'
        migrations.AlterField(
            model_name="IntakeIssue",
            name="intake",
            field=models.ForeignKey(
                "db.Intake",
                related_name="issue_intake",
                on_delete=django.db.models.deletion.CASCADE,
            ),
        ),
        # Update ForeignKey related_name for 'issue'
        migrations.AlterField(
            model_name="IntakeIssue",
            name="issue",
            field=models.ForeignKey(
                "db.Issue",
                related_name="issue_intake",
                on_delete=django.db.models.deletion.CASCADE,
            ),
        ),
        # Update ForeignKey related_name for 'duplicate_to'
        migrations.AlterField(
            model_name="IntakeIssue",
            name="duplicate_to",
            field=models.ForeignKey(
                "db.Issue",
                related_name="intake_duplicate",
                on_delete=django.db.models.deletion.SET_NULL,
                null=True,
            ),
        ),
        # Update Meta options
        migrations.AlterModelOptions(
            name="IntakeIssue",
            options={
                "verbose_name": "IntakeIssue",
                "verbose_name_plural": "IntakeIssues",
                "ordering": ("-created_at",),
            },
        ),
        # Update db_table
        migrations.AlterModelTable(
            name="IntakeIssue",
            table="intake_issues",
        ),
        migrations.RenameField(
            model_name="project",
            old_name="inbox_view",
            new_name="intake_view",
        ),
        migrations.RenameField(
            model_name="deployboard",
            old_name="inbox",
            new_name="intake",
        ),
        migrations.RenameField(
            model_name="projectdeployboard",
            old_name="inbox",
            new_name="intake",
        ),
        migrations.RemoveConstraint(
            model_name="intake",
            name="inbox_unique_name_project_when_deleted_at_null",
        ),
        migrations.AlterField(
            model_name="deployboard",
            name="intake",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="publish_intake",
                to="db.intake",
            ),
        ),
        migrations.AlterField(
            model_name="projectdeployboard",
            name="intake",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="board_intake",
                to="db.intake",
            ),
        ),
        migrations.AddConstraint(
            model_name="intake",
            constraint=models.UniqueConstraint(
                condition=models.Q(("deleted_at__isnull", True)),
                fields=("name", "project"),
                name="intake_unique_name_project_when_deleted_at_null",
            ),
        ),
    ]
