From 6d9515b8a5571421721cc3fa3e96ee053aa15260 Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Fri, 15 May 2026 16:02:51 +0000 Subject: [PATCH] batch3 final: backfill default chat pane for pre-batch3 sessions Sessions created before Batch 3 have no rows in session_panes, so the Workspace renders "No panes" on first open. Idempotent INSERT inserts a default chat pane at position 0 for any session without one. NOT EXISTS guard makes the statement a no-op after the first run. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/server/src/schema.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/server/src/schema.sql b/apps/server/src/schema.sql index ef62af4..a573e94 100644 --- a/apps/server/src/schema.sql +++ b/apps/server/src/schema.sql @@ -57,3 +57,12 @@ CREATE TABLE IF NOT EXISTS session_panes ( UNIQUE (session_id, position) ); CREATE INDEX IF NOT EXISTS idx_session_panes_session ON session_panes (session_id); + +-- Backfill: ensure every session has at least one pane (default Chat). +-- Idempotent: skipped on subsequent runs because session_panes rows already exist. +INSERT INTO session_panes (session_id, position, kind, state) +SELECT s.id, 0, 'chat', '{}'::jsonb +FROM sessions s +WHERE NOT EXISTS ( + SELECT 1 FROM session_panes p WHERE p.session_id = s.id +);