# Generated by Django 4.2.21 on 2025-11-06 15:15

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


class Migration(migrations.Migration):

    dependencies = [
        ("incidents", "0029_add_custom_fields_to_incident"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("jira_app", "0001_initial_oss"),
    ]

    operations = [
        migrations.CreateModel(
            name="JiraPostMortem",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "jira_issue_key",
                    models.CharField(
                        help_text="Jira issue key (e.g., INCIDENT-123)",
                        max_length=32,
                        unique=True,
                    ),
                ),
                (
                    "jira_issue_id",
                    models.CharField(
                        help_text="Jira issue ID", max_length=32, unique=True
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="jira_postmortems_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "incident",
                    models.OneToOneField(
                        help_text="Incident this post-mortem is for",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="jira_postmortem_for",
                        to="incidents.incident",
                    ),
                ),
            ],
            options={
                "verbose_name": "Jira Post-mortem",
                "verbose_name_plural": "Jira Post-mortems",
                "db_table": "jira_postmortem",
            },
        ),
    ]
