feat: set default utc timezone for postgresql in DatabaseService (#8112)

Co-authored-by: tianzhipeng <tzpabc@gmail.com>
This commit is contained in:
jeevi cao 2025-08-19 03:31:05 +08:00 committed by GitHub
commit a973e747cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,7 +156,9 @@ class DatabaseService(Service):
"check_same_thread": False,
"timeout": settings.db_connect_timeout,
}
# For PostgreSQL, set the timezone to UTC
if settings.database_url and settings.database_url.startswith(("postgresql", "postgres")):
return {"options": "-c timezone=utc"}
return {}
def on_connection(self, dbapi_connection, _connection_record) -> None: