feat: set default utc timezone for postgresql in DatabaseService (#8112)
Co-authored-by: tianzhipeng <tzpabc@gmail.com>
This commit is contained in:
parent
ec7579d578
commit
a973e747cb
1 changed files with 3 additions and 1 deletions
|
|
@ -156,7 +156,9 @@ class DatabaseService(Service):
|
||||||
"check_same_thread": False,
|
"check_same_thread": False,
|
||||||
"timeout": settings.db_connect_timeout,
|
"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 {}
|
return {}
|
||||||
|
|
||||||
def on_connection(self, dbapi_connection, _connection_record) -> None:
|
def on_connection(self, dbapi_connection, _connection_record) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue