Add active user session tracking from agent user :0 2026-07-16 15:46

user     pts/0        2026-07-16 15:50 (:0)
user     pts/1        2026-07-16 16:46 (:0)
user     pts/2        2026-07-17 09:05 (:0) to server UI
This commit is contained in:
2026-07-17 09:44:39 +07:00
parent 8e62eaf3f3
commit 7b2e5172ea
9 changed files with 195 additions and 5 deletions
+8
View File
@@ -38,3 +38,11 @@ def run_migrations():
with engine.connect() as conn:
conn.execute(text("ALTER TABLE audit_log ADD COLUMN username TEXT"))
conn.commit()
# Heartbeat: add sessions column if missing
if "heartbeats" in insp.get_table_names():
hb_cols = {c["name"] for c in insp.get_columns("heartbeats")}
if "sessions" not in hb_cols:
with engine.connect() as conn:
conn.execute(text("ALTER TABLE heartbeats ADD COLUMN sessions TEXT"))
conn.commit()