"feat: Refactor database connection in app.py and myp.db-shm"
This commit is contained in:
@@ -1673,7 +1673,7 @@ def api_admin_system_health():
|
|||||||
# 1. Datenbank-Schema-Integrität prüfen
|
# 1. Datenbank-Schema-Integrität prüfen
|
||||||
try:
|
try:
|
||||||
# Test verschiedene kritische Tabellen und Spalten
|
# Test verschiedene kritische Tabellen und Spalten
|
||||||
db_session.execute("SELECT COUNT(*) FROM guest_requests WHERE duration_minutes IS NOT NULL")
|
db_session.execute(text("SELECT COUNT(*) FROM guest_requests WHERE duration_minutes IS NOT NULL"))
|
||||||
schema_integrity = "OK"
|
schema_integrity = "OK"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
critical_errors.append({
|
critical_errors.append({
|
||||||
@@ -1697,7 +1697,7 @@ def api_admin_system_health():
|
|||||||
missing_columns = []
|
missing_columns = []
|
||||||
for table, column in schema_checks:
|
for table, column in schema_checks:
|
||||||
try:
|
try:
|
||||||
db_session.execute(f"SELECT {column} FROM {table} LIMIT 1")
|
db_session.execute(text(f"SELECT {column} FROM {table} LIMIT 1"))
|
||||||
except Exception:
|
except Exception:
|
||||||
missing_columns.append(f"{table}.{column}")
|
missing_columns.append(f"{table}.{column}")
|
||||||
|
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user