This commit is contained in:
JiriUhlir
2026-05-29 10:35:56 +02:00
parent 765c840120
commit 48a9b20379
5 changed files with 277 additions and 1 deletions
+13
View File
@@ -38,10 +38,23 @@ def run_migrations():
)
"""
)
con.execute(
"""
CREATE TABLE IF NOT EXISTS workers (
worker_id TEXT PRIMARY KEY,
status TEXT,
last_seen_at TEXT,
current_job_id INTEGER,
started_at TEXT,
metadata_json TEXT
)
"""
)
con.execute("CREATE INDEX IF NOT EXISTS idx_jobs_status_created ON jobs(status, created_at)")
con.execute("CREATE INDEX IF NOT EXISTS idx_jobs_target_status ON jobs(target_type, target_id, status)")
con.execute("CREATE INDEX IF NOT EXISTS idx_job_logs_job_id ON job_logs(job_id, id)")
con.execute("CREATE INDEX IF NOT EXISTS idx_workers_last_seen ON workers(last_seen_at)")
try:
con.execute("ALTER TABLE jobs ADD COLUMN created_by_display_name TEXT")