add index

This commit is contained in:
Pete Matsyburka
2025-11-21 13:41:51 +02:00
parent 7ed27bb413
commit abd579103d
3 changed files with 16 additions and 5 deletions
@@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddSendSmsSend2faSmsIndex < ActiveRecord::Migration[8.0]
def change
add_index :submission_events, %i[account_id created_at],
where: "event_type IN ('send_sms', 'send_2fa_sms')",
name: 'index_submissions_events_on_sms_event_types'
end
end
+2 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_11_21_093511) do
ActiveRecord::Schema[8.0].define(version: 2025_11_21_113910) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "plpgsql"
@@ -297,6 +297,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_21_093511) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "account_id"
t.index ["account_id", "created_at"], name: "index_submissions_events_on_sms_event_types", where: "((event_type)::text = ANY ((ARRAY['send_sms'::character varying, 'send_2fa_sms'::character varying])::text[]))"
t.index ["account_id"], name: "index_submission_events_on_account_id"
t.index ["created_at"], name: "index_submission_events_on_created_at"
t.index ["submission_id"], name: "index_submission_events_on_submission_id"