add is first to completed submitters

This commit is contained in:
Pete Matsyburka
2025-11-21 11:27:28 +02:00
parent 1a68053f4e
commit 3102900776
3 changed files with 21 additions and 3 deletions
@@ -0,0 +1,12 @@
# frozen_string_literal: true
class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0]
def change
# rubocop:disable Rails/ThreeStateBooleanColumn
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, :submission_id, unique: true, where: 'is_first = TRUE'
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[8.0].define(version: 2025_11_21_090556) do
ActiveRecord::Schema[8.0].define(version: 2025_11_21_092044) do
# These are extensions that must be enabled in order to support this database
enable_extension "btree_gin"
enable_extension "plpgsql"
@@ -118,7 +118,10 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_21_090556) do
t.datetime "created_at", null: false
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 ["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