Skip to content

Commit

Permalink
Add migration to reindex all message_thread to fix data layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mirrec committed Oct 17, 2023
1 parent bea0a0f commit 423448e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/searchable/message_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ def self.reindex_with_tag_id(tag_id)
end

def self.reindex_all
::MessageThread.includes(:tags, :messages, folder: :box).find_each { |mt| ::Searchable::Indexer.index_message_thread(mt) }
::MessageThread.includes(:tags, :messages, :message_thread_note, folder: :box).find_each { |mt| ::Searchable::Indexer.index_message_thread(mt) }
end
end
10 changes: 10 additions & 0 deletions db/migrate/20231017132154_reindex_message_threads.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class ReindexMessageThreads < ActiveRecord::Migration[7.0]
def up
say_with_time("Reindexing MessageThreads") do
Searchable::MessageThread.reindex_all
end
end

def down
end
end

0 comments on commit 423448e

Please sign in to comment.