ALTER TABLE ai_conversation ADD COLUMN IF NOT EXISTS access_visibility VARCHAR(32) NOT NULL DEFAULT 'owner';
ALTER TABLE ai_conversation ADD COLUMN IF NOT EXISTS can_ask VARCHAR(32) NOT NULL DEFAULT 'owner';
ALTER TABLE ai_conversation ADD COLUMN IF NOT EXISTS project_uid INT;
ALTER TABLE ai_conversation ADD COLUMN IF NOT EXISTS model_uid UUID;
ALTER TABLE ai_conversation ADD COLUMN IF NOT EXISTS model_name VARCHAR(256);

CREATE INDEX IF NOT EXISTS idx_ai_conv_access_vis ON ai_conversation (access_visibility);
CREATE INDEX IF NOT EXISTS idx_ai_conv_project_uid ON ai_conversation (project_id, project_uid) WHERE project_uid IS NOT NULL;
