fix: use default_factory for callable defaults in ORM dataclasses (#28730)

This commit is contained in:
-LAN-
2025-11-27 08:39:49 +08:00
committed by GitHub
parent 4ccc150fd1
commit 38522e5dfa
12 changed files with 269 additions and 76 deletions

View File

@@ -1103,7 +1103,9 @@ class WorkflowAppLog(TypeBase):
sa.Index("workflow_app_log_workflow_run_id_idx", "workflow_run_id"),
)
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuid4()), init=False)
id: Mapped[str] = mapped_column(
StringUUID, insert_default=lambda: str(uuid4()), default_factory=lambda: str(uuid4()), init=False
)
tenant_id: Mapped[str] = mapped_column(StringUUID)
app_id: Mapped[str] = mapped_column(StringUUID)
workflow_id: Mapped[str] = mapped_column(StringUUID, nullable=False)