add index

This commit is contained in:
Pete Matsyburka committed 2026-11-02 10:18:16 +02:00
1 parent 7a75a6c887
commit 2692b8a1b5
2 files changed
+14 -1

No files matched your search

@@ -0,0 +1,12 @@
# frozen_string_literal: true
class AddSubmissionEventsAccountEventTypeCreatedAtIndex < ActiveRecord::Migration[8.1]
def change
return unless ENV['MULTITENANT'] == 'true'
add_index :submission_events, %i[account_id created_at],
where: "event_type = 'start_kba'",
if_not_exists: true,
name: 'index_submission_events_on_account_created_at_start_kba'
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.1].define(version: 2026_11_01_120000) do
ActiveRecord::Schema[8.1].define(version: 2026_11_02_120000) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "pg_catalog.plpgsql"
@@ -362,6 +362,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_01_120000) do
t.datetime "updated_at", null: false
t.index ["account_id", "created_at"], name: "index_submissions_events_on_sms_event_types", where: "((event_type)::text = ANY (ARRAY[('send_sms'::character varying)::text, ('send_2fa_sms'::character varying)::text]))"
t.index ["account_id"], name: "index_submission_events_on_account_id"
t.index ["account_id", "created_at"], name: "index_submission_events_on_account_created_at_start_kba", where: "((event_type)::text = 'start_kba'::text)"
t.index ["created_at"], name: "index_submission_events_on_created_at"
t.index ["submission_id"], name: "index_submission_events_on_submission_id"
t.index ["submitter_id"], name: "index_submission_events_on_submitter_id"