Files
multica/server/migrations/214_chat_session_project.up.sql
Bohan Jiang 3f2e1c68d7 fix(migrations): resolve VCS migration prefix collision (213-215) and unblock deploy (MUL-3772) (#5883)
Renumber the six VCS migrations off the 213/214/215 prefix collisions to a unique contiguous tail 216-221 (tables before indexes), and make 214_chat_session_project idempotent (ADD COLUMN IF NOT EXISTS) so the #5868 rename-induced re-run no-ops instead of crashing. Fixes the red migration lint on main and unblocks the dev deploy.
2026-07-24 15:28:43 +08:00

15 lines
901 B
SQL

-- Chat sessions may opt into one project's durable context. Keep this as a
-- soft reference: adding a foreign key would validate the established,
-- write-active chat_session table and take a cross-table lock during deploy.
-- Create/delete handlers serialize on the project row, project deletion clears
-- existing references, and daemon claim revalidates workspace ownership before
-- injecting any context.
--
-- IF NOT EXISTS because this migration was first shipped as 213_chat_session_project
-- and later renumbered to 214 (#5868, dodging a prefix collision). Environments
-- that already applied it under the old 213 name have the column but not the 214
-- version row, so the runner re-applies it under the new name; without the guard
-- that re-run fails with "column already exists" (SQLSTATE 42701) and blocks deploy.
ALTER TABLE chat_session
ADD COLUMN IF NOT EXISTS project_id UUID;