diff --git a/db/migrate/20251022152158_add_index_to_conversations_identifier.rb b/db/migrate/20251022152158_add_index_to_conversations_identifier.rb new file mode 100644 index 000000000..e7d02b53d --- /dev/null +++ b/db/migrate/20251022152158_add_index_to_conversations_identifier.rb @@ -0,0 +1,6 @@ +class AddIndexToConversationsIdentifier < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + def change + add_index :conversations, [:identifier, :account_id], name: 'index_conversations_on_identifier_and_account_id', algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index c0d539f6a..022a0101e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2025_10_03_091242) do +ActiveRecord::Schema[7.1].define(version: 2025_10_22_152158) do # These extensions should be enabled to support this database enable_extension "pg_stat_statements" enable_extension "pg_trgm" @@ -676,6 +676,7 @@ ActiveRecord::Schema[7.1].define(version: 2025_10_03_091242) do 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 ["identifier", "account_id"], name: "index_conversations_on_identifier_and_account_id" t.index ["inbox_id"], name: "index_conversations_on_inbox_id" t.index ["priority"], name: "index_conversations_on_priority" t.index ["status", "account_id"], name: "index_conversations_on_status_and_account_id"