diff --git a/backend/database/models.py b/backend/database/models.py index 5ced0c15..511b4efd 100644 --- a/backend/database/models.py +++ b/backend/database/models.py @@ -253,7 +253,7 @@ class CloudSettings(Base): device_name = Column(String, nullable=True) account_user_id = Column(String, nullable=True) connected_at = Column(DateTime, nullable=True) - updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + updated_at = Column(DateTime, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC)) class MCPClientBinding(Base): diff --git a/backend/services/cloud.py b/backend/services/cloud.py index 1485b4df..92a3df28 100644 --- a/backend/services/cloud.py +++ b/backend/services/cloud.py @@ -140,13 +140,13 @@ def _get_or_create_row(db: Session) -> DBCloudSettings: def _store_key(db: Session, *, api_key: str, device_name: str | None, account_user_id: str | None): - from datetime import datetime + from datetime import UTC, datetime row = _get_or_create_row(db) row.api_key = api_key row.device_name = device_name row.account_user_id = account_user_id - row.connected_at = datetime.utcnow() + row.connected_at = datetime.now(UTC) db.commit()