fix: auto-migrate models table schema if old columns present
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user