mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-09-08 20:50:38 +00:00
This index helps to speed up queries that joins the `topics` table against the `ai_topics_embeddings` table on the `topic_id` column. There are a number of queries which filters on `ai_topics_embeddings.model_id` so we are including that in the index as well.
12 lines
239 B
Ruby
12 lines
239 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddIndexToAiTopicsEmbeddings < ActiveRecord::Migration[7.2]
|
|
def up
|
|
add_index :ai_topics_embeddings, %i[topic_id model_id]
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|