FIX: Split statements to avoid timeout (#1062)

This commit is contained in:
Roman Rizzi 2025-01-14 12:54:18 -03:00 committed by GitHub
parent c029bc8979
commit 09ca123757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -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