fix: migration for rebuilding multi model search
This commit is contained in:
parent
723968f042
commit
f513bdb97d
5 changed files with 19 additions and 2 deletions
|
@ -13,8 +13,10 @@
|
|||
# display_name :string
|
||||
# email :string
|
||||
# encrypted_password :string default(""), not null
|
||||
# failed_attempts :integer
|
||||
# last_sign_in_at :datetime
|
||||
# last_sign_in_ip :string
|
||||
# locked_at :datetime
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# provider :string default("email"), not null
|
||||
|
@ -28,6 +30,7 @@
|
|||
# ui_settings :jsonb
|
||||
# uid :string default(""), not null
|
||||
# unconfirmed_email :string
|
||||
# unlock_token :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
# display_name :string
|
||||
# email :string
|
||||
# encrypted_password :string default(""), not null
|
||||
# failed_attempts :integer
|
||||
# last_sign_in_at :datetime
|
||||
# last_sign_in_ip :string
|
||||
# locked_at :datetime
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# provider :string default("email"), not null
|
||||
|
@ -28,6 +30,7 @@
|
|||
# ui_settings :jsonb
|
||||
# uid :string default(""), not null
|
||||
# unconfirmed_email :string
|
||||
# unlock_token :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
|
11
db/migrate/20221212061802_enable_multi_searchable.rb
Normal file
11
db/migrate/20221212061802_enable_multi_searchable.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class EnableMultiSearchable < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
Contact.rebuild_pg_search_documents
|
||||
PgSearch::Multisearch.rebuild(Conversation)
|
||||
PgSearch::Multisearch.rebuild(Message)
|
||||
end
|
||||
|
||||
def down
|
||||
PgSearch::Document.delete_all
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_12_05_081737) do
|
||||
ActiveRecord::Schema.define(version: 2022_12_12_061802) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
|
|
|
@ -44,7 +44,7 @@ describe ::TextSearch do
|
|||
params = { q: 'pot' }
|
||||
result = described_class.new(user_1, params).perform
|
||||
expect(result[:messages].length).to be 1
|
||||
expect(result[:contacts].length).to be 1
|
||||
expect(result[:contacts].length).to be 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue