fix(db): fix logger calls in schema drift check (standard logging API)
This commit is contained in:
parent
f1645a1715
commit
133b0ffb4c
|
|
@ -87,7 +87,7 @@ def _warn_on_schema_drift() -> None:
|
||||||
engine = create_engine(sync_url, pool_pre_ping=True)
|
engine = create_engine(sync_url, pool_pre_ping=True)
|
||||||
inspector = sa_inspect(engine)
|
inspector = sa_inspect(engine)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error("schema_drift_check_failed", error=str(exc))
|
logger.error("schema_drift_check_failed: %s", str(exc))
|
||||||
engine.dispose() if "engine" in dir() else None # type: ignore[name-defined]
|
engine.dispose() if "engine" in dir() else None # type: ignore[name-defined]
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -102,15 +102,15 @@ def _warn_on_schema_drift() -> None:
|
||||||
if col.name not in db_cols:
|
if col.name not in db_cols:
|
||||||
missing.append(f"COLUMN {table_name}.{col.name}")
|
missing.append(f"COLUMN {table_name}.{col.name}")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error("schema_drift_check_failed", error=str(exc))
|
logger.error("schema_drift_check_failed: %s", str(exc))
|
||||||
finally:
|
finally:
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
|
|
||||||
if missing:
|
if missing:
|
||||||
logger.error(
|
logger.error(
|
||||||
"schema_drift_detected",
|
"schema_drift_detected: %s (hint: %s)",
|
||||||
missing=missing,
|
missing,
|
||||||
hint="DB schema does not match models. Run scripts/check_schema.py for details.",
|
"DB schema does not match models. Run scripts/check_schema.py for details.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue