mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-06 09:20:14 +00:00
FIX: Use COPY to avoid migration statement timeout
This commit is contained in:
parent
65bbcd71fc
commit
f1598b4679
@ -68,14 +68,15 @@ class NewEmbeddingsTables < ActiveRecord::Migration[7.2]
|
|||||||
|
|
||||||
# Copy data from old tables to new tables
|
# 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)
|
COPY ai_topics_embeddings FROM (SELECT * FROM ai_topic_embeddings)
|
||||||
SELECT * FROM ai_topic_embeddings;
|
SQL
|
||||||
|
|
||||||
INSERT INTO ai_posts_embeddings (post_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at)
|
execute <<~SQL
|
||||||
SELECT * FROM ai_post_embeddings;
|
COPY ai_posts_embeddings FROM (SELECT * FROM ai_post_embeddings)
|
||||||
|
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)
|
execute <<~SQL
|
||||||
SELECT * FROM ai_document_fragment_embeddings;
|
COPY ai_document_fragments_embeddings FROM (SELECT * FROM ai_document_fragment_embeddings)
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user