Add latest_content field

This commit is contained in:
shamoon
2026-03-31 11:52:13 -07:00
parent 2aa0c9f0b4
commit 2ea83374ed
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Generated by Django 5.2.12 on 2026-03-31 18:52
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
("documents", "0016_sha256_checksums"),
]
operations = [
migrations.AddField(
model_name="document",
name="latest_content",
field=models.TextField(
blank=True,
help_text="Materialized effective content for root documents. Uses the latest version content when available.",
null=True,
verbose_name="latest content",
),
),
]

View File

@@ -196,6 +196,16 @@ class Document(SoftDeleteModel, ModelWithOwner): # type: ignore[django-manager-
),
)
latest_content = models.TextField(
_("latest content"),
blank=True,
null=True,
help_text=_(
"Materialized effective content for root documents. "
"Uses the latest version content when available.",
),
)
content_length = models.GeneratedField(
expression=Length("content"),
output_field=PositiveIntegerField(default=0),