Skip to content

A platform for community discussion. Free, open, simple.

DEV: Move 'unknown OID' embeddings fix into core (#35519)

David Taylor7d794f45b658
diff --git a/config/initializers/000-active_record.rb b/config/initializers/000-active_record.rb
new file mode 100644
index 00000000000..7a860ddff84
--- /dev/null
+++ b/config/initializers/000-active_record.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+# No ActiveRecord for these models. Avoids the "unknown OID" warnings.
+# We need it in core, because plugins are not loaded in core tests,
+# but the tables are likely still present in the test database.
+ActiveRecord.schema_cache_ignored_tables.push(
+ "ai_topics_embeddings",
+ "ai_user_embeddings",
+ "ai_document_fragments_embeddings",
+)
diff --git a/plugins/discourse-ai/plugin.rb b/plugins/discourse-ai/plugin.rb
index 56b46d8cecd..72472350420 100644
--- a/plugins/discourse-ai/plugin.rb
+++ b/plugins/discourse-ai/plugin.rb
@@ -72,9 +72,6 @@ DiscourseAi::Configuration::Module::NAMES.each do |module_name|
end
after_initialize do
- # No ActiveRecord for these models. Avoids the "unknown OID" warnings.
- ActiveRecord.schema_cache_ignored_tables.push(*DiscourseAi::Embeddings::Schema::EMBEDDING_TABLES)
-
if defined?(Rack::MiniProfiler)
Rack::MiniProfiler.config.skip_paths << "/discourse-ai/ai-bot/artifacts"
end