add contact is_verified flag to precompute filterable field

This commit is contained in:
Tanmay Sharma
2025-07-22 13:51:31 +04:00
parent 4b4afc4c52
commit 5fcf47bc86
4 changed files with 50 additions and 3 deletions
@@ -0,0 +1,7 @@
class AddIsVerifiedToContacts < ActiveRecord::Migration[7.1]
def change
add_column :contacts, :is_verified, :boolean, default: false, null: false
add_index :contacts, :is_verified
add_index :contacts, [:account_id, :is_verified], name: 'index_contacts_on_account_id_and_is_verified'
end
end
+4 -1
View File
@@ -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_07_14_104358) do
ActiveRecord::Schema[7.1].define(version: 2025_07_22_093235) do
# These extensions should be enabled to support this database
enable_extension "pg_stat_statements"
enable_extension "pg_trgm"
@@ -538,14 +538,17 @@ ActiveRecord::Schema[7.1].define(version: 2025_07_14_104358) do
t.string "location", default: ""
t.string "country_code", default: ""
t.boolean "blocked", default: false, null: false
t.boolean "is_verified", default: false, null: false
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", "is_verified"], name: "index_contacts_on_account_id_and_is_verified"
t.index ["account_id", "last_activity_at"], name: "index_contacts_on_account_id_and_last_activity_at", order: { last_activity_at: "DESC NULLS LAST" }
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 ["blocked"], name: "index_contacts_on_blocked"
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 ["is_verified"], name: "index_contacts_on_is_verified"
t.index ["name", "email", "phone_number", "identifier"], name: "index_contacts_on_name_email_phone_number_identifier", opclass: :gin_trgm_ops, using: :gin
t.index ["phone_number", "account_id"], name: "index_contacts_on_phone_number_and_account_id"
end