# Generated by Django 4.2.7 on 2023-12-04 11:07

import uuid

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


class Migration(migrations.Migration):
    replaces = [
        ("confluence", "0001_squashed_0007"),
        ("confluence", "0008_alter_runbook_service_name_and_more"),
        ("confluence", "0009_confluencepage_version_and_more"),
    ]

    dependencies = [
        ("incidents", "0030_status_enum_constraints"),
        ("incidents", "0006_alter_user_slack_id"),
        ("incidents", "0005_alter_incidentupdate_communication_lead"),
    ]

    operations = [
        migrations.CreateModel(
            name="ConfluencePage",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("name", models.CharField(max_length=255)),
                ("page_id", models.PositiveBigIntegerField(db_index=True, unique=True)),
                ("page_url", models.URLField(max_length=1024)),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="When was the DB record created, not when the page was created on Confluence.",
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True,
                        help_text="When was the DB record updated, not when the page was created on Confluence.",
                    ),
                ),
                ("page_edit_url", models.URLField(max_length=1024)),
                ("body_export_view", models.TextField(blank=True, null=True)),
                ("body_storage", models.TextField(blank=True, null=True)),
                ("body_view", models.TextField(blank=True, null=True)),
                ("version", models.JSONField(default=dict)),
            ],
        ),
        migrations.CreateModel(
            name="PostMortem",
            fields=[
                (
                    "confluencepage_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="confluence.confluencepage",
                    ),
                ),
                (
                    "incident",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="postmortem_for",
                        to="incidents.incident",
                    ),
                ),
            ],
            bases=("confluence.confluencepage",),
        ),
        migrations.CreateModel(
            name="Runbook",
            fields=[
                (
                    "confluencepage_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="confluence.confluencepage",
                    ),
                ),
                ("service_name", models.CharField(max_length=255)),
                ("service_type", models.CharField(max_length=255)),
                ("title", models.CharField(max_length=255)),
            ],
            bases=("confluence.confluencepage",),
        ),
    ]
