Jun 28 - Code optimize - Fix Critical/High issues

This commit is contained in:
2026-06-28 11:30:04 -04:00
parent 26d1b77dec
commit 4937a5b529
4 changed files with 17 additions and 7 deletions
+5 -3
View File
@@ -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