fix: Add index in conversation and reporting event (#4577)
Fixes chatwoot/product#422
This commit is contained in:
parent
cb38ec3267
commit
8d04894744
4 changed files with 16 additions and 6 deletions
|
@ -31,6 +31,7 @@
|
|||
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
|
||||
# index_conversations_on_campaign_id (campaign_id)
|
||||
# index_conversations_on_contact_inbox_id (contact_inbox_id)
|
||||
# index_conversations_on_last_activity_at (last_activity_at)
|
||||
# index_conversations_on_status_and_account_id (status,account_id)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
#
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_reporting_events_on_account_id (account_id)
|
||||
# index_reporting_events_on_created_at (created_at)
|
||||
# index_reporting_events_on_inbox_id (inbox_id)
|
||||
# index_reporting_events_on_name (name)
|
||||
# index_reporting_events_on_user_id (user_id)
|
||||
# index_reporting_events_on_account_id (account_id)
|
||||
# index_reporting_events_on_conversation_id (conversation_id)
|
||||
# index_reporting_events_on_created_at (created_at)
|
||||
# index_reporting_events_on_inbox_id (inbox_id)
|
||||
# index_reporting_events_on_name (name)
|
||||
# index_reporting_events_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class ReportingEvent < ApplicationRecord
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddIndexToConversationAndReportingEvent < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_index :conversations, :last_activity_at
|
||||
add_index :reporting_events, :conversation_id
|
||||
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_04_24_081117) do
|
||||
ActiveRecord::Schema.define(version: 2022_04_28_101325) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
|
@ -361,6 +361,7 @@ ActiveRecord::Schema.define(version: 2022_04_24_081117) do
|
|||
t.index ["assignee_id", "account_id"], name: "index_conversations_on_assignee_id_and_account_id"
|
||||
t.index ["campaign_id"], name: "index_conversations_on_campaign_id"
|
||||
t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id"
|
||||
t.index ["last_activity_at"], name: "index_conversations_on_last_activity_at"
|
||||
t.index ["status", "account_id"], name: "index_conversations_on_status_and_account_id"
|
||||
t.index ["team_id"], name: "index_conversations_on_team_id"
|
||||
end
|
||||
|
@ -662,6 +663,7 @@ ActiveRecord::Schema.define(version: 2022_04_24_081117) do
|
|||
t.datetime "event_start_time"
|
||||
t.datetime "event_end_time"
|
||||
t.index ["account_id"], name: "index_reporting_events_on_account_id"
|
||||
t.index ["conversation_id"], name: "index_reporting_events_on_conversation_id"
|
||||
t.index ["created_at"], name: "index_reporting_events_on_created_at"
|
||||
t.index ["inbox_id"], name: "index_reporting_events_on_inbox_id"
|
||||
t.index ["name"], name: "index_reporting_events_on_name"
|
||||
|
|
Loading…
Reference in a new issue