From 4aebf898d2f372813a5559a48bedd0b023c56841 Mon Sep 17 00:00:00 2001 From: ai_coder Date: Fri, 16 Oct 2026 15:36:27 +0000 Subject: [PATCH] fix: auto-migrate models table schema if old columns present --- app/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/main.py b/app/main.py index 04a1587..4a8cf27 100644 --- a/app/main.py +++ b/app/main.py @@ -34,6 +34,14 @@ def get_db() -> sqlite3.Connection: def init_db(): db = get_db() + # Автомиграция таблицы models если создана со старой схемой + try: + cols = [r[1] for r in db.execute("PRAGMA table_info(models)").fetchall()] + if cols and "raw_base" not in cols: + db.execute("DROP TABLE models") + except Exception: + pass + db.executescript(""" CREATE TABLE IF NOT EXISTS arena_text_leaderboard ( rank INTEGER,