Der Reiter X-Recherche-Konten heisst jetzt Recherche-Zugaenge und zeigt oben eine Telegram-Karte: Session gueltig/Problem, verbunden als, Stand. Die Daten meldet der Monitor (Commit 7dae63e) in die geteilte Tabelle system_status, das Portal liest nur an (GET /api/x-scraper/telegram-status, tolerant wenn Tabelle/Eintrag fehlt). Migration fuer die Portal-Staging-DB liegt bei. Promote-Reihenfolge: Monitor VOR Portal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
47 Zeilen
1.4 KiB
Python
47 Zeilen
1.4 KiB
Python
"""Migration 2026-07-25: Tabelle system_status anlegen (Telegram-Session-Status).
|
|
|
|
Der Monitor legt die Tabelle beim Start selbst an und meldet dort u.a. den
|
|
Status seiner Telegram-Session (Key telegram_session). Die
|
|
Portal-Staging-Umgebung nutzt eine EIGENE Datenbank ohne laufenden Monitor,
|
|
deshalb dieses Skript. Idempotent (CREATE TABLE IF NOT EXISTS), es werden
|
|
keine Daten eingefügt.
|
|
|
|
Ausführung:
|
|
DB_PATH=/home/claude-dev/AegisSight-Monitor-staging/data/osint.db python3 migrations/2026-07-25_system_status.py
|
|
DB_PATH=/home/claude-dev/osint-data/osint.db python3 migrations/2026-07-25_system_status.py
|
|
"""
|
|
import os
|
|
import sqlite3
|
|
import sys
|
|
|
|
|
|
def main(db_path: str) -> int:
|
|
if not os.path.exists(db_path):
|
|
print(f"FEHLER: DB nicht gefunden: {db_path}", file=sys.stderr)
|
|
return 1
|
|
|
|
conn = sqlite3.connect(db_path, timeout=60)
|
|
conn.execute("PRAGMA busy_timeout = 60000")
|
|
conn.execute("PRAGMA journal_mode = WAL")
|
|
|
|
print(f"Migration auf {db_path}")
|
|
|
|
conn.execute("""
|
|
CREATE TABLE IF NOT EXISTS system_status (
|
|
key TEXT PRIMARY KEY,
|
|
value TEXT,
|
|
updated_at TEXT DEFAULT CURRENT_TIMESTAMP
|
|
)
|
|
""")
|
|
print(" + system_status angelegt (oder vorhanden)")
|
|
|
|
conn.commit()
|
|
conn.close()
|
|
print("Migration abgeschlossen.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
db_path = os.environ.get("DB_PATH", "/home/claude-dev/osint-data/osint.db")
|
|
sys.exit(main(db_path))
|