fix(workflow): update updated_at default to use UTC timezone (#11960)

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN- 2024-12-22 14:55:18 +08:00 committed by GitHub
parent 6b49889041
commit 750662eb08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
import json
from collections.abc import Mapping, Sequence
from datetime import datetime
from datetime import UTC, datetime
from enum import Enum, StrEnum
from typing import Any, Optional, Union
@ -106,7 +106,10 @@ class Workflow(db.Model):
created_at: Mapped[datetime] = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
updated_by: Mapped[Optional[str]] = mapped_column(StringUUID)
updated_at: Mapped[datetime] = mapped_column(
db.DateTime, nullable=False, server_default=func.current_timestamp(), server_onupdate=func.current_timestamp()
db.DateTime,
nullable=False,
default=datetime.now(UTC).replace(tzinfo=None),
server_onupdate=func.current_timestamp(),
)
_environment_variables: Mapped[str] = mapped_column(
"environment_variables", db.Text, nullable=False, server_default="{}"