# Generated by Django 4.2.20 on 2025-06-10 05:30

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),
        ("annotations", "0032_annotation_annotations_structu_54f773_idx"),
    ]

    operations = [
        migrations.CreateModel(
            name="NoteRevision",
            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="note_revisions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "note",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="revisions",
                        to="annotations.note",
                    ),
                ),
            ],
            options={
                "ordering": ("note_id", "version"),
                "indexes": [
                    models.Index(
                        fields=["note"], name="annotations_note_id_9e8739_idx"
                    ),
                    models.Index(
                        fields=["author"], name="annotations_author__4a0d3b_idx"
                    ),
                    models.Index(
                        fields=["created"], name="annotations_created_448a9d_idx"
                    ),
                ],
                "unique_together": {("note", "version")},
            },
        ),
    ]
