-- Phase 2: Schema extension for search, detail, and diagram linking columns. -- Adds exchange snapshot data, processor tree metadata, and diagram content hash. ALTER TABLE route_executions ADD COLUMN IF NOT EXISTS exchange_bodies String DEFAULT '', ADD COLUMN IF NOT EXISTS exchange_headers String DEFAULT '', ADD COLUMN IF NOT EXISTS processor_depths Array(UInt16) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_parent_indexes Array(Int32) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_error_messages Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_error_stacktraces Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_input_bodies Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_output_bodies Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_input_headers Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_output_headers Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS processor_diagram_node_ids Array(String) DEFAULT [], ADD COLUMN IF NOT EXISTS diagram_content_hash String DEFAULT ''; -- Skip indexes for full-text search on new text columns ALTER TABLE route_executions ADD INDEX IF NOT EXISTS idx_exchange_bodies exchange_bodies TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 4, ADD INDEX IF NOT EXISTS idx_exchange_headers exchange_headers TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 4; -- Skip index on error_stacktrace (not indexed in 01-schema.sql, needed for SRCH-05) ALTER TABLE route_executions ADD INDEX IF NOT EXISTS idx_error_stacktrace error_stacktrace TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 4;