-- P0 post-reboot CPU pressure: bounded fallback index for truth-chain source lookup.
-- Run outside an explicit transaction because CREATE INDEX CONCURRENTLY requires it.

CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS btree_gin;

CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_awooop_conv_event_content_preview_trgm
ON awooop_conversation_event
USING gin (content_preview gin_trgm_ops)
WHERE content_preview IS NOT NULL;

CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_awooop_conv_event_project_content_preview_trgm
ON awooop_conversation_event
USING gin (project_id, content_preview gin_trgm_ops)
WHERE content_preview IS NOT NULL;
