From 53e12a627ffa0ee69ea1623afcf0afc0369f52ab Mon Sep 17 00:00:00 2001 From: Koshkoshinsk Date: Sun, 12 Apr 2026 10:43:42 +0000 Subject: [PATCH] chore(v2): drop session-DB schema band-aid in writeSessionRouting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The forward-compat CREATE TABLE IF NOT EXISTS papered over a stale-DB problem we don't need to support — the canonical INBOUND_SCHEMA in src/db/schema.ts already creates session_routing for every fresh session DB. Pre-existing local DBs that predate the schema entry are treated as garbage and recreated, not migrated. Schema is the single source of truth; write paths shouldn't carry defensive table-creation logic. --- src/session-manager.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/session-manager.ts b/src/session-manager.ts index aad0717..8f05e28 100644 --- a/src/session-manager.ts +++ b/src/session-manager.ts @@ -176,16 +176,6 @@ export function writeSessionRouting(agentGroupId: string, sessionId: string): vo db.pragma('journal_mode = DELETE'); db.pragma('busy_timeout = 5000'); try { - // Lightweight forward-compat: create the table for older session DBs - // that predate this column. - db.exec(` - CREATE TABLE IF NOT EXISTS session_routing ( - id INTEGER PRIMARY KEY CHECK (id = 1), - channel_type TEXT, - platform_id TEXT, - thread_id TEXT - ); - `); db.prepare( `INSERT INTO session_routing (id, channel_type, platform_id, thread_id) VALUES (1, @channel_type, @platform_id, @thread_id)