fix: save version error

This commit is contained in:
tao.chen
2026-08-05 19:14:05 +08:00
parent c4529782b5
commit 90c3b5ee6f
+10
View File
@@ -406,6 +406,16 @@ async def create_server_object_payload(
)
session.add(item)
await session.flush()
# Force SQLAlchemy to round-trip server-default columns
# (created_at / updated_at / is_deleted) in the *current* async
# context. ``eager_defaults="auto"`` on the mapper does not
# guarantee a refresh for non-PK server defaults; without this,
# ``storage_payload`` (a sync helper) would later trigger a lazy
# refresh through the async driver and raise MissingGreenlet.
await session.refresh(
item,
attribute_names=["created_at", "updated_at", "is_deleted"],
)
item.relative_path = payload.relative_path
upload.storage_object_id = item.storage_object_id
upload.upload_status = "completed"