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) <noreply@anthropic.com>
This commit is contained in:
@@ -57,3 +57,12 @@ CREATE TABLE IF NOT EXISTS session_panes (
|
|||||||
UNIQUE (session_id, position)
|
UNIQUE (session_id, position)
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS idx_session_panes_session ON session_panes (session_id);
|
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
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user