Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix: guard pg_search update with skip_embedding

Dounx838a49601c77
diff --git a/migrations/versioned/000008_migrate_untagged_faq.up.sql b/migrations/versioned/000008_migrate_untagged_faq.up.sql
index 1b97e4854..56fc6a0bf 100644
--- a/migrations/versioned/000008_migrate_untagged_faq.up.sql
+++ b/migrations/versioned/000008_migrate_untagged_faq.up.sql
@@ -1,6 +1,14 @@
-- Migration: Create "未分类" tag for each knowledge base that has untagged entries
-- and update chunks, knowledges, and embeddings to reference the new tag
-ALTER EXTENSION pg_search UPDATE;
+DO $$
+BEGIN
+ IF current_setting('app.skip_embedding', true) = 'true' THEN
+ RAISE NOTICE 'Skipping pg_search update (app.skip_embedding=true)';
+ RETURN;
+ END IF;
+
+ ALTER EXTENSION pg_search UPDATE;
+END $$;
DO $$
DECLARE
diff --git a/migrations/versioned/000011_pg_search_update.up.sql b/migrations/versioned/000011_pg_search_update.up.sql
index afe58d5b4..897024341 100644
--- a/migrations/versioned/000011_pg_search_update.up.sql
+++ b/migrations/versioned/000011_pg_search_update.up.sql
@@ -1,4 +1,12 @@
-- Migration 000011: Update pg_search extension to latest version
-- Equivalent to: psql -c 'ALTER EXTENSION pg_search UPDATE;'
-ALTER EXTENSION pg_search UPDATE;
+DO $$
+BEGIN
+ IF current_setting('app.skip_embedding', true) = 'true' THEN
+ RAISE NOTICE 'Skipping pg_search update (app.skip_embedding=true)';
+ RETURN;
+ END IF;
+
+ ALTER EXTENSION pg_search UPDATE;
+END $$;