Browse Source

fix: the date is incorrect if the db field is timestamp and the TZ is not the UTC (#4624)

Co-authored-by: liuzhenghua-jk <liuzhenghua-jk@360shuke.com>
liuzhenghua 11 months ago
parent
commit
ad620f02c7
1 changed files with 2 additions and 1 deletions
  1. 2 1
      api/config.py

+ 2 - 1
api/config.py

@@ -179,7 +179,8 @@ class Config:
             'pool_size': int(get_env('SQLALCHEMY_POOL_SIZE')),
             'max_overflow': int(get_env('SQLALCHEMY_MAX_OVERFLOW')),
             'pool_recycle': int(get_env('SQLALCHEMY_POOL_RECYCLE')),
-            'pool_pre_ping': get_bool_env('SQLALCHEMY_POOL_PRE_PING')
+            'pool_pre_ping': get_bool_env('SQLALCHEMY_POOL_PRE_PING'),
+            'connect_args': {'options': '-c timezone=UTC'},
         }
 
         self.SQLALCHEMY_ECHO = get_bool_env('SQLALCHEMY_ECHO')