-- Phase 3.1: MarketApp 增加 tool_policy(Agent 工具/MCP 权限沙箱策略) -- 幂等:仅当列不存在时才 ALTER SET @db = 'aiflow'; SET @tbl = 'market_apps'; SET @col = 'tool_policy'; SET @exists = ( SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = @db AND table_name = @tbl AND column_name = @col ); SET @sql = IF(@exists = 0, 'ALTER TABLE market_apps ADD COLUMN tool_policy JSON NULL', 'SELECT 1'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;