Files
multica/server/migrations/215_chat_session_project_index.up.sql
Bohan Jiang be7c3521aa fix(migrations): renumber chat_session_project off colliding prefix 213 (#5868)
PR #5765 (MUL-5150) branched before #5841 merged, so both landed a 213
migration and Backend CI's TestMigrationNumericPrefixesStayUniqueAfterLegacySet
failed on main. Bump #5765's pair to the next free prefixes, preserving the
column-before-index order:
  213_chat_session_project       -> 214_chat_session_project
  214_chat_session_project_index -> 215_chat_session_project_index

MUL-5251

Co-authored-by: Bohan-J <bohan@devv.ai>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-24 13:03:25 +08:00

8 lines
422 B
SQL

-- Project deletion clears chat-session references by project_id. Build this
-- partial index concurrently so the established chat_session write path stays
-- available throughout rollout. A single statement is required because
-- CREATE INDEX CONCURRENTLY cannot run inside a transaction.
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_chat_session_project
ON chat_session (project_id)
WHERE project_id IS NOT NULL;