|
2 | 2 | class DropOldEmbeddingTables < ActiveRecord::Migration[7.2] |
3 | 3 | def up |
4 | 4 | # Copy rag embeddings created during deploy. |
5 | | - execute <<~SQL |
6 | | - INSERT INTO ai_document_fragments_embeddings (rag_document_fragment_id, model_id, model_version, strategy_id, strategy_version, digest, embeddings, created_at, updated_at) |
7 | | - ( |
8 | | - SELECT ai_document_fragment_embeddings.* |
9 | | - FROM ai_document_fragment_embeddings |
10 | | - LEFT OUTER JOIN ai_document_fragments_embeddings ON ai_document_fragment_embeddings.rag_document_fragment_id = ai_document_fragments_embeddings.rag_document_fragment_id |
11 | | - WHERE ai_document_fragments_embeddings.rag_document_fragment_id IS NULL |
12 | | - ) |
13 | | - SQL |
14 | | - |
15 | | - execute <<~SQL |
16 | | - DROP INDEX IF EXISTS ai_topic_embeddings_1_1_search_bit; |
17 | | - DROP INDEX IF EXISTS ai_topic_embeddings_2_1_search_bit; |
18 | | - DROP INDEX IF EXISTS ai_topic_embeddings_3_1_search_bit; |
19 | | - DROP INDEX IF EXISTS ai_topic_embeddings_4_1_search_bit; |
20 | | - DROP INDEX IF EXISTS ai_topic_embeddings_5_1_search_bit; |
21 | | - DROP INDEX IF EXISTS ai_topic_embeddings_6_1_search_bit; |
22 | | - DROP INDEX IF EXISTS ai_topic_embeddings_7_1_search_bit; |
23 | | - DROP INDEX IF EXISTS ai_topic_embeddings_8_1_search_bit; |
24 | | -
|
25 | | - DROP INDEX IF EXISTS ai_post_embeddings_1_1_search_bit; |
26 | | - DROP INDEX IF EXISTS ai_post_embeddings_2_1_search_bit; |
27 | | - DROP INDEX IF EXISTS ai_post_embeddings_3_1_search_bit; |
28 | | - DROP INDEX IF EXISTS ai_post_embeddings_4_1_search_bit; |
29 | | - DROP INDEX IF EXISTS ai_post_embeddings_5_1_search_bit; |
30 | | - DROP INDEX IF EXISTS ai_post_embeddings_6_1_search_bit; |
31 | | - DROP INDEX IF EXISTS ai_post_embeddings_7_1_search_bit; |
32 | | - DROP INDEX IF EXISTS ai_post_embeddings_8_1_search_bit; |
33 | | -
|
34 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_1_1_search_bit; |
35 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_2_1_search_bit; |
36 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_3_1_search_bit; |
37 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_4_1_search_bit; |
38 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_5_1_search_bit; |
39 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_6_1_search_bit; |
40 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_7_1_search_bit; |
41 | | - DROP INDEX IF EXISTS ai_document_fragment_embeddings_8_1_search_bit; |
42 | | - SQL |
43 | | - |
44 | | - drop_table :ai_topic_embeddings |
45 | | - drop_table :ai_post_embeddings |
46 | | - drop_table :ai_document_fragment_embeddings |
| 5 | + # noop. TODO(roman): Will follow-up with a new migration to drop these tables. |
47 | 6 | end |
48 | 7 |
|
49 | 8 | def down |
|
0 commit comments