chore(v2): drop session-DB schema band-aid in writeSessionRouting

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.
This commit is contained in:
Koshkoshinsk
2026-04-12 10:43:42 +00:00
parent 7bd8c6ad41
commit 53e12a627f

View File

@@ -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)