# Generated by Django 5.2.11 on 2026-03-02 17:48

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


class Migration(migrations.Migration):
    dependencies = [
        ("documents", "0014_savedview_visibility_to_ui_settings"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="document",
            name="version_index",
            field=models.PositiveIntegerField(
                blank=True,
                db_index=True,
                help_text="Index of this version within the root document.",
                null=True,
                verbose_name="version index",
            ),
        ),
        migrations.AddConstraint(
            model_name="document",
            constraint=models.UniqueConstraint(
                condition=models.Q(
                    ("root_document__isnull", False),
                    ("version_index__isnull", False),
                ),
                fields=("root_document", "version_index"),
                name="documents_document_root_version_index_uniq",
            ),
        ),
    ]
