# Generated by Django 4.2.20 on 2025-06-27 18:38

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("documents", "0015_remove_document_description_embedding"),
    ]

    operations = [
        migrations.CreateModel(
            name="DocumentSummaryRevision",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("version", models.PositiveIntegerField()),
                ("diff", models.TextField(blank=True)),
                ("snapshot", models.TextField(blank=True, null=True)),
                ("checksum_base", models.CharField(blank=True, max_length=64)),
                ("checksum_full", models.CharField(blank=True, max_length=64)),
                (
                    "created",
                    models.DateTimeField(
                        db_index=True, default=django.utils.timezone.now
                    ),
                ),
                (
                    "author",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="document_summary_revisions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="summary_revisions",
                        to="documents.document",
                    ),
                ),
            ],
            options={
                "ordering": ("document_id", "version"),
                "indexes": [
                    models.Index(
                        fields=["document"], name="documents_d_documen_29cde2_idx"
                    ),
                    models.Index(
                        fields=["author"], name="documents_d_author__c3c284_idx"
                    ),
                    models.Index(
                        fields=["created"], name="documents_d_created_388996_idx"
                    ),
                ],
                "unique_together": {("document", "version")},
            },
        ),
    ]
