pull/402/head
Pete Matsyburka 4 weeks ago
parent 89613113de
commit 180c542a9f

@ -19,8 +19,8 @@
#
# Indexes
#
# index_completed_submitters_on_account_id (account_id)
# index_completed_submitters_on_account_id_and_completed_at (account_id,completed_at) WHERE (is_first = true)
# index_completed_submitters_account_id_completed_at_is_first (account_id,completed_at) WHERE (is_first = true)
# index_completed_submitters_on_account_id_and_completed_at (account_id,completed_at)
# index_completed_submitters_on_submission_id (submission_id) UNIQUE WHERE (is_first = true)
# index_completed_submitters_on_submitter_id (submitter_id) UNIQUE
#

@ -6,7 +6,9 @@ class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0]
add_column :completed_submitters, :is_first, :boolean
# rubocop:enable Rails/ThreeStateBooleanColumn
add_index :completed_submitters, %i[account_id completed_at], where: 'is_first = TRUE'
add_index :completed_submitters, %i[account_id completed_at],
where: 'is_first = TRUE',
name: 'index_completed_submitters_account_id_completed_at_is_first'
add_index :completed_submitters, :submission_id, unique: true, where: 'is_first = TRUE'
end
end

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddCompletedAtIndexToCompletedSubmitters < ActiveRecord::Migration[8.0]
def change
add_index :completed_submitters, %i[account_id completed_at],
name: 'index_completed_submitters_on_account_id_and_completed_at'
remove_index :completed_submitters, :account_id
end
end

@ -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_092044) do
ActiveRecord::Schema[8.0].define(version: 2025_11_21_093511) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "plpgsql"
@ -119,8 +119,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_21_092044) do
t.datetime "updated_at", null: false
t.string "verification_method"
t.boolean "is_first"
t.index ["account_id", "completed_at"], name: "index_completed_submitters_on_account_id_and_completed_at", where: "(is_first = true)"
t.index ["account_id"], name: "index_completed_submitters_on_account_id"
t.index ["account_id", "completed_at"], name: "index_completed_submitters_account_id_completed_at_is_first", where: "(is_first = true)"
t.index ["account_id", "completed_at"], name: "index_completed_submitters_on_account_id_and_completed_at"
t.index ["submission_id"], name: "index_completed_submitters_on_submission_id", unique: true, where: "(is_first = true)"
t.index ["submitter_id"], name: "index_completed_submitters_on_submitter_id", unique: true
end

Loading…
Cancel
Save