fix(models,db): delegate timestamps to DB server and configure connection pool
- Replace default=datetime.utcnow with server_default=func.now() across all 16 models (17 columns) for consistent, timezone-aware timestamps from PostgreSQL - Upgrade DateTime columns to DateTime(timezone=True) for timestamptz storage - Configure SQLAlchemy engine pool: pool_size=20, max_overflow=10, pool_recycle=3600, pool_pre_ping=True - Remove unused datetime imports from model files
This commit is contained in:
@@ -14,7 +14,13 @@ def _get_engine():
|
||||
global _engine
|
||||
if _engine is None:
|
||||
from app.config import settings
|
||||
_engine = create_engine(settings.DATABASE_URL)
|
||||
_engine = create_engine(
|
||||
settings.DATABASE_URL,
|
||||
pool_size=20,
|
||||
max_overflow=10,
|
||||
pool_recycle=3600,
|
||||
pool_pre_ping=True,
|
||||
)
|
||||
return _engine
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user