From 14618ef61a867ed69c5db55ce1ec25d8ab832a04 Mon Sep 17 00:00:00 2001 From: Lori Bailey <44073106+elceebee@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:50:44 +0100 Subject: [PATCH] Add indexes to fields commonly filtered on for sending emails --- ...0240711122121_add_indexes_to_email_related_filters.rb | 9 +++++++++ db/schema.rb | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240711122121_add_indexes_to_email_related_filters.rb diff --git a/db/migrate/20240711122121_add_indexes_to_email_related_filters.rb b/db/migrate/20240711122121_add_indexes_to_email_related_filters.rb new file mode 100644 index 00000000000..165c4ade97e --- /dev/null +++ b/db/migrate/20240711122121_add_indexes_to_email_related_filters.rb @@ -0,0 +1,9 @@ +class AddIndexesToEmailRelatedFilters < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :candidates, :submission_blocked, algorithm: :concurrently + add_index :candidates, :account_locked, algorithm: :concurrently + add_index :candidates, :unsubscribed_from_emails, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index e3918575b62..9323087f5cf 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: 2024_06_25_105759) do +ActiveRecord::Schema[7.1].define(version: 2024_07_11_122121) do create_sequence "qualifications_public_id_seq", start: 120000 # These are extensions that must be enabled in order to support this database @@ -378,9 +378,12 @@ t.boolean "unsubscribed_from_emails", default: false t.boolean "submission_blocked", default: false, null: false t.boolean "account_locked", default: false, null: false + t.index ["account_locked"], name: "index_candidates_on_account_locked" t.index ["email_address"], name: "index_candidates_on_email_address", unique: true t.index ["fraud_match_id"], name: "index_candidates_on_fraud_match_id" t.index ["magic_link_token"], name: "index_candidates_on_magic_link_token", unique: true + t.index ["submission_blocked"], name: "index_candidates_on_submission_blocked" + t.index ["unsubscribed_from_emails"], name: "index_candidates_on_unsubscribed_from_emails" end create_table "chasers_sent", force: :cascade do |t|