feat(db): register DocumentFile and document.files relationship

This commit is contained in:
CREDO23 2026-06-02 16:10:44 +02:00
parent 0483af8023
commit 5e5f51b3a0

View file

@ -1478,6 +1478,11 @@ class Document(BaseModel, TimestampMixin):
chunks = relationship( chunks = relationship(
"Chunk", back_populates="document", cascade="all, delete-orphan" "Chunk", back_populates="document", cascade="all, delete-orphan"
) )
# Original upload + future derived artifacts (redacted, filled-form).
# Model lives in app.file_storage.persistence to keep that feature cohesive.
files = relationship(
"DocumentFile", back_populates="document", cascade="all, delete-orphan"
)
class DocumentVersion(BaseModel, TimestampMixin): class DocumentVersion(BaseModel, TimestampMixin):
@ -2931,6 +2936,7 @@ from app.automations.persistence import ( # noqa: E402, F401
AutomationRun, AutomationRun,
AutomationTrigger, AutomationTrigger,
) )
from app.file_storage.persistence import DocumentFile # noqa: E402, F401
engine = create_async_engine( engine = create_async_engine(
DATABASE_URL, DATABASE_URL,