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:
@@ -176,16 +176,6 @@ export function writeSessionRouting(agentGroupId: string, sessionId: string): vo
|
|||||||
db.pragma('journal_mode = DELETE');
|
db.pragma('journal_mode = DELETE');
|
||||||
db.pragma('busy_timeout = 5000');
|
db.pragma('busy_timeout = 5000');
|
||||||
try {
|
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(
|
db.prepare(
|
||||||
`INSERT INTO session_routing (id, channel_type, platform_id, thread_id)
|
`INSERT INTO session_routing (id, channel_type, platform_id, thread_id)
|
||||||
VALUES (1, @channel_type, @platform_id, @thread_id)
|
VALUES (1, @channel_type, @platform_id, @thread_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user