Jun 28 - Fix issue with missing table - Tenant branding error
This commit is contained in:
@@ -7,11 +7,14 @@ 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 logging
|
||||
import sqlalchemy.exc
|
||||
|
||||
from app import db
|
||||
from app.utils.time_utils import now_eastern
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TenantSettings(db.Model):
|
||||
__tablename__ = 'tenant_settings'
|
||||
@@ -46,9 +49,11 @@ class TenantSettings(db.Model):
|
||||
"""
|
||||
try:
|
||||
row = cls.query.first()
|
||||
except (sqlalchemy.exc.ProgrammingError, sqlalchemy.exc.OperationalError):
|
||||
except (sqlalchemy.exc.ProgrammingError, sqlalchemy.exc.OperationalError) as exc:
|
||||
# Table 'tenant_settings' doesn't exist — phase33 migration not yet applied.
|
||||
# Any other DB error (connection failure, permission error) is re-raised.
|
||||
logger.warning('TenantSettings.get_or_default: table missing — %s: %s',
|
||||
type(exc).__name__, exc)
|
||||
return None
|
||||
if row is not None:
|
||||
return row
|
||||
|
||||
Reference in New Issue
Block a user