fix(mcp): apply_pending tolère l'absence de api_tokens (migration 0007, scope B #111)

This commit is contained in:
Colin Maudry
2026-07-10 15:19:58 +02:00
parent ff78b86ad0
commit 71ad4dd1ca
2 changed files with 23 additions and 2 deletions
+8 -2
View File
@@ -66,9 +66,15 @@ def apply_pending() -> None:
except sqlite3.OperationalError as exc:
# Sur une DB fraîche (schéma déjà à jour), certaines migrations
# sont sans effet : ADD COLUMN → "duplicate column name",
# RENAME COLUMN → "no such column". On les ignore.
# RENAME COLUMN → "no such column", et un ALTER sur une table pas
# encore créée → "no such table" (elle sera créée plus tard par
# init_schema avec la colonne déjà dans SCHEMA).
err = str(exc)
if "duplicate column name" not in err and "no such column" not in err:
if (
"duplicate column name" not in err
and "no such column" not in err
and "no such table" not in err
):
raise
conn.execute(
"INSERT INTO schema_migrations (id, applied_at) VALUES (?, ?)",