mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	chore: Add missing indexes for attachments table (#5588)
- index for attachments table - index for conversations table
This commit is contained in:
		| @@ -14,6 +14,11 @@ | ||||
| #  account_id       :integer          not null | ||||
| #  message_id       :integer          not null | ||||
| # | ||||
| # Indexes | ||||
| # | ||||
| #  index_attachments_on_account_id  (account_id) | ||||
| #  index_attachments_on_message_id  (message_id) | ||||
| # | ||||
|  | ||||
| class Attachment < ApplicationRecord | ||||
|   include Rails.application.routes.url_helpers | ||||
|   | ||||
| @@ -31,8 +31,10 @@ | ||||
| #  index_conversations_on_account_id_and_display_id   (account_id,display_id) UNIQUE | ||||
| #  index_conversations_on_assignee_id_and_account_id  (assignee_id,account_id) | ||||
| #  index_conversations_on_campaign_id                 (campaign_id) | ||||
| #  index_conversations_on_contact_id                  (contact_id) | ||||
| #  index_conversations_on_contact_inbox_id            (contact_inbox_id) | ||||
| #  index_conversations_on_first_reply_created_at      (first_reply_created_at) | ||||
| #  index_conversations_on_inbox_id                    (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) | ||||
|   | ||||
| @@ -0,0 +1,8 @@ | ||||
| class AddIndexToMessageAttachments < ActiveRecord::Migration[6.1] | ||||
|   def change | ||||
|     add_index :attachments, :account_id | ||||
|     add_index :attachments, :message_id | ||||
|     add_index :conversations, :contact_id | ||||
|     add_index :conversations, :inbox_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_09_30_025317) do | ||||
| ActiveRecord::Schema.define(version: 2022_10_10_212946) do | ||||
|  | ||||
|   # These are extensions that must be enabled in order to support this database | ||||
|   enable_extension "pg_stat_statements" | ||||
| @@ -148,6 +148,8 @@ ActiveRecord::Schema.define(version: 2022_09_30_025317) do | ||||
|     t.datetime "updated_at", null: false | ||||
|     t.string "fallback_title" | ||||
|     t.string "extension" | ||||
|     t.index ["account_id"], name: "index_attachments_on_account_id" | ||||
|     t.index ["message_id"], name: "index_attachments_on_message_id" | ||||
|   end | ||||
|  | ||||
|   create_table "automation_rules", force: :cascade do |t| | ||||
| @@ -410,8 +412,10 @@ ActiveRecord::Schema.define(version: 2022_09_30_025317) do | ||||
|     t.index ["account_id"], name: "index_conversations_on_account_id" | ||||
|     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_id"], name: "index_conversations_on_contact_id" | ||||
|     t.index ["contact_inbox_id"], name: "index_conversations_on_contact_inbox_id" | ||||
|     t.index ["first_reply_created_at"], name: "index_conversations_on_first_reply_created_at" | ||||
|     t.index ["inbox_id"], name: "index_conversations_on_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" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sojan Jose
					Sojan Jose