3a0a0cff9c
Migration 000002 creates the pg_trgm extension only inside the conditional embeddings block guarded by app.skip_embedding. Deployments that use a non-postgres retrieve driver (Qdrant, Elasticsearch, Milvus, etc.) skip that block entirely, so pg_trgm is never installed. When migration 000041 then runs CREATE INDEX ... USING GIN (lower(title) gin_trgm_ops) the statement fails and the whole migration is rolled back, leaving task_pending_ops and task_dead_letters uncreated. The application keeps starting (migrations are best-effort), but wiki ingest enqueue silently fails and wiki pages are never produced. Re-issue CREATE EXTENSION IF NOT EXISTS pg_trgm at the top of 000041 so the extension is guaranteed present at the moment the trigram index is created. The statement is idempotent on environments where 000002 already installed it, and surfaces a clear, early error on environments where the extension genuinely cannot be loaded. Fixes #1319. Co-authored-by: Cursor <cursoragent@cursor.com>