mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
feat(perf): contact page loading speed (#7629)
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
# index_contacts_on_name_email_phone_number_identifier (name,email,phone_number,identifier) USING gin
|
# index_contacts_on_name_email_phone_number_identifier (name,email,phone_number,identifier) USING gin
|
||||||
# index_contacts_on_nonempty_fields (account_id,email,phone_number,identifier) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
# index_contacts_on_nonempty_fields (account_id,email,phone_number,identifier) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||||
# index_contacts_on_phone_number_and_account_id (phone_number,account_id)
|
# index_contacts_on_phone_number_and_account_id (phone_number,account_id)
|
||||||
|
# index_resolved_contact_account_id (account_id) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||||
# uniq_email_per_account_contact (email,account_id) UNIQUE
|
# uniq_email_per_account_contact (email,account_id) UNIQUE
|
||||||
# uniq_identifier_per_account_contact (identifier,account_id) UNIQUE
|
# uniq_identifier_per_account_contact (identifier,account_id) UNIQUE
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class AddPartialIndexContactAccountId < ActiveRecord::Migration[7.0]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_index :contacts, [:account_id], where: "(email <> '' OR phone_number <> '' OR identifier <> '')",
|
||||||
|
name: 'index_resolved_contact_account_id', algorithm: :concurrently
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do
|
ActiveRecord::Schema[7.0].define(version: 2023_07_27_065605) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
@@ -408,6 +408,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_054138) do
|
|||||||
t.index "lower((email)::text), account_id", name: "index_contacts_on_lower_email_account_id"
|
t.index "lower((email)::text), account_id", name: "index_contacts_on_lower_email_account_id"
|
||||||
t.index ["account_id", "email", "phone_number", "identifier"], name: "index_contacts_on_nonempty_fields", where: "(((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))"
|
t.index ["account_id", "email", "phone_number", "identifier"], name: "index_contacts_on_nonempty_fields", where: "(((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))"
|
||||||
t.index ["account_id"], name: "index_contacts_on_account_id"
|
t.index ["account_id"], name: "index_contacts_on_account_id"
|
||||||
|
t.index ["account_id"], name: "index_resolved_contact_account_id", where: "(((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))"
|
||||||
t.index ["email", "account_id"], name: "uniq_email_per_account_contact", unique: true
|
t.index ["email", "account_id"], name: "uniq_email_per_account_contact", unique: true
|
||||||
t.index ["identifier", "account_id"], name: "uniq_identifier_per_account_contact", unique: true
|
t.index ["identifier", "account_id"], name: "uniq_identifier_per_account_contact", unique: true
|
||||||
t.index ["name", "email", "phone_number", "identifier"], name: "index_contacts_on_name_email_phone_number_identifier", opclass: :gin_trgm_ops, using: :gin
|
t.index ["name", "email", "phone_number", "identifier"], name: "index_contacts_on_name_email_phone_number_identifier", opclass: :gin_trgm_ops, using: :gin
|
||||||
|
|||||||
Reference in New Issue
Block a user