-- Full-text search indexes (workstream G). Expression indexes cannot be declared on tables owned by -- another schema file, so this migration is hand-written. The expressions MUST match the ones used in -- src/lib/search/service.ts (`msgTsv` / `titleTsv`) for the planner to pick them up. CREATE INDEX IF NOT EXISTS "messages_content_fts_idx" ON "messages" USING gin (to_tsvector('simple', coalesce("content", ''))); --> statement-breakpoint CREATE INDEX IF NOT EXISTS "conversations_title_fts_idx" ON "conversations" USING gin (to_tsvector('simple', coalesce("title", ''))); --> statement-breakpoint CREATE INDEX IF NOT EXISTS "shared_conversations_user_active_idx" ON "shared_conversations" ("user_id", "created_at") WHERE "revoked_at" IS NULL;