Files
multica/server/migrations/156_chat_session_pinned_index.up.sql
Multica Eve 6a72f248a1 fix: unblock release migrations (#5162)
Co-authored-by: Eve <eve@multica-ai.local>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-09 17:59:19 +08:00

9 lines
434 B
SQL

-- Partial index over pinned rows only: the pinned group is small, and the list
-- query orders by pinned_at within a single (workspace, creator) scan.
--
-- Single-statement migration: CREATE INDEX CONCURRENTLY cannot run inside a
-- transaction or a multi-command string.
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_chat_session_pinned
ON chat_session (creator_id, workspace_id, pinned_at DESC)
WHERE pinned_at IS NOT NULL;