From 09ca1237576056aad60226aa7d81b551c6b778cb Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Tue, 14 Jan 2025 12:54:18 -0300 Subject: [PATCH] FIX: Split statements to avoid timeout (#1062) --- db/migrate/20241230153300_new_embeddings_tables.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/migrate/20241230153300_new_embeddings_tables.rb b/db/migrate/20241230153300_new_embeddings_tables.rb index 59ee5e69..34e6ca91 100644 --- a/db/migrate/20241230153300_new_embeddings_tables.rb +++ b/db/migrate/20241230153300_new_embeddings_tables.rb @@ -67,13 +67,17 @@ class NewEmbeddingsTables < ActiveRecord::Migration[7.2] end # Copy data from old tables to new tables - execute <<-SQL + execute <<~SQL INSERT INTO ai_topics_embeddings (topic_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at) SELECT * FROM ai_topic_embeddings; + SQL + execute <<~SQL INSERT INTO ai_posts_embeddings (post_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at) SELECT * FROM ai_post_embeddings; + SQL + execute <<~SQL INSERT INTO ai_document_fragments_embeddings (rag_document_fragment_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at) SELECT * FROM ai_document_fragment_embeddings; SQL