fix: auto-migrate models table schema if old columns present

This commit is contained in:
2026-10-16 15:36:27 +00:00
parent 296fa9c7ad
commit 4aebf898d2
+8
View File
@@ -34,6 +34,14 @@ def get_db() -> sqlite3.Connection:
def init_db(): def init_db():
db = get_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(""" db.executescript("""
CREATE TABLE IF NOT EXISTS arena_text_leaderboard ( CREATE TABLE IF NOT EXISTS arena_text_leaderboard (
rank INTEGER, rank INTEGER,