Jun 28 - Code optimize - Fix Critical/High issues
This commit is contained in:
@@ -7,6 +7,8 @@ One row per tenant DB. Created on first save; reads fall back to defaults
|
||||
when no row exists so tenant-zero needs zero data migration.
|
||||
"""
|
||||
|
||||
import sqlalchemy.exc
|
||||
|
||||
from app import db
|
||||
from app.utils.time_utils import now_eastern
|
||||
|
||||
@@ -44,9 +46,9 @@ class TenantSettings(db.Model):
|
||||
"""
|
||||
try:
|
||||
row = cls.query.first()
|
||||
except Exception:
|
||||
# ProgrammingError: Table 'tenant_settings' doesn't exist
|
||||
# (phase33 migration not yet applied to this tenant DB)
|
||||
except (sqlalchemy.exc.ProgrammingError, sqlalchemy.exc.OperationalError):
|
||||
# Table 'tenant_settings' doesn't exist — phase33 migration not yet applied.
|
||||
# Any other DB error (connection failure, permission error) is re-raised.
|
||||
return None
|
||||
if row is not None:
|
||||
return row
|
||||
|
||||
Reference in New Issue
Block a user