# Generated by Django 4.2.14 on 2024-07-22 13:22
from django.db import migrations, models
from django.conf import settings
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ("db", "0071_rename_issueproperty_issueuserproperty_and_more"),
    ]

    operations = [
        migrations.AddField(
            model_name="issueattachment",
            name="external_id",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AddField(
            model_name="issueattachment",
            name="external_source",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.CreateModel(
            name="UserRecentVisit",
            fields=[
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="Created At"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Last Modified At"
                    ),
                ),
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        unique=True,
                    ),
                ),
                ("entity_identifier", models.UUIDField(null=True)),
                (
                    "entity_name",
                    models.CharField(
                        choices=[
                            ("VIEW", "View"),
                            ("PAGE", "Page"),
                            ("ISSUE", "Issue"),
                            ("CYCLE", "Cycle"),
                            ("MODULE", "Module"),
                            ("PROJECT", "Project"),
                        ],
                        max_length=30,
                    ),
                ),
                ("visited_at", models.DateTimeField(auto_now=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="%(class)s_created_by",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Created By",
                    ),
                ),
                (
                    "project",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="project_%(class)s",
                        to="db.project",
                    ),
                ),
                (
                    "updated_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="%(class)s_updated_by",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Last Modified By",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_recent_visit",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "workspace",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="workspace_%(class)s",
                        to="db.workspace",
                    ),
                ),
            ],
            options={
                "verbose_name": "User Recent Visit",
                "verbose_name_plural": "User Recent Visits",
                "db_table": "user_recent_visits",
                "ordering": ("-created_at",),
            },
        ),
        migrations.RemoveField(
            model_name="project",
            name="start_date",
        ),
        migrations.RemoveField(
            model_name="project",
            name="target_date",
        ),
        migrations.AlterField(
            model_name="issuesequence",
            name="sequence",
            field=models.PositiveBigIntegerField(db_index=True, default=1),
        ),
        migrations.AlterField(
            model_name="project",
            name="identifier",
            field=models.CharField(
                db_index=True, max_length=12, verbose_name="Project Identifier"
            ),
        ),
        migrations.AlterField(
            model_name="projectidentifier",
            name="name",
            field=models.CharField(db_index=True, max_length=12),
        ),
    ]
