refactor: use EnumText for DocumentSegment.type (#33979)

This commit is contained in:
tmimmanuel
2026-03-23 21:37:51 +01:00
committed by GitHub
parent f2c71f3668
commit 5d2cb3cd80
4 changed files with 16 additions and 4 deletions

View File

@ -43,6 +43,7 @@ from .enums import (
IndexingStatus,
ProcessRuleMode,
SegmentStatus,
SegmentType,
SummaryStatus,
)
from .model import App, Tag, TagBinding, UploadFile
@ -998,7 +999,9 @@ class ChildChunk(Base):
# indexing fields
index_node_id = mapped_column(String(255), nullable=True)
index_node_hash = mapped_column(String(255), nullable=True)
type = mapped_column(String(255), nullable=False, server_default=sa.text("'automatic'"))
type: Mapped[SegmentType] = mapped_column(
EnumText(SegmentType, length=255), nullable=False, server_default=sa.text("'automatic'")
)
created_by = mapped_column(StringUUID, nullable=False)
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, server_default=sa.func.current_timestamp())
updated_by = mapped_column(StringUUID, nullable=True)