From 423448e42479eb81dac51de48fb341b558f0d876 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Tue, 17 Oct 2023 15:22:47 +0200 Subject: [PATCH] Add migration to reindex all message_thread to fix data layer --- app/models/searchable/message_thread.rb | 2 +- db/migrate/20231017132154_reindex_message_threads.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20231017132154_reindex_message_threads.rb diff --git a/app/models/searchable/message_thread.rb b/app/models/searchable/message_thread.rb index 5de325e61..4fc2f1611 100644 --- a/app/models/searchable/message_thread.rb +++ b/app/models/searchable/message_thread.rb @@ -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 diff --git a/db/migrate/20231017132154_reindex_message_threads.rb b/db/migrate/20231017132154_reindex_message_threads.rb new file mode 100644 index 000000000..f04f751c8 --- /dev/null +++ b/db/migrate/20231017132154_reindex_message_threads.rb @@ -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