populate completed_at

This commit is contained in:
Pete Matsyburka
2026-07-01 21:50:02 +03:00
parent 1902cdaa55
commit 9194879c43
3 changed files with 59 additions and 1 deletions
@@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddIndexOnSubmissionsCompletedAt < ActiveRecord::Migration[8.1]
def change
add_index :submissions, %i[account_id completed_at],
where: 'completed_at IS NOT NULL AND archived_at IS NULL',
name: 'index_submissions_on_account_id_and_completed_at',
if_not_exists: true
return unless connection.supports_partial_index?
add_index :submissions, %i[account_id id],
where: 'completed_at IS NULL AND archived_at IS NULL',
name: 'index_submissions_on_account_id_and_id_pending',
if_not_exists: true
end
end