diff --git a/app/models/profile.rb b/app/models/profile.rb index 5cc0c49c2a1..c735a6cac3a 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -17,6 +17,11 @@ class Profile < ApplicationRecord scope(:active, -> { where(active: true) }) scope(:verified, -> { where.not(verified_at: nil) }) + has_one :establishing_in_person_enrollment, + -> { where(status: :establishing).order(created_at: :desc) }, + class_name: 'InPersonEnrollment', foreign_key: :profile_id, inverse_of: :profile, + dependent: :destroy + enum deactivation_reason: { password_reset: 1, encryption_error: 2, diff --git a/db/primary_migrate/20230727195406_add_in_person_verification_pending_at_to_profiles.rb b/db/primary_migrate/20230727195406_add_in_person_verification_pending_at_to_profiles.rb new file mode 100644 index 00000000000..d81b49e9ee0 --- /dev/null +++ b/db/primary_migrate/20230727195406_add_in_person_verification_pending_at_to_profiles.rb @@ -0,0 +1,7 @@ +class AddInPersonVerificationPendingAtToProfiles < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + + def change + add_column :profiles, :in_person_verification_pending_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index cae30ecad3f..c45f12932c0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_07_20_183509) do +ActiveRecord::Schema[7.0].define(version: 2023_07_27_195406) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "pgcrypto" @@ -446,6 +446,7 @@ t.datetime "fraud_rejection_at" t.datetime "gpo_verification_pending_at" t.integer "fraud_pending_reason" + t.datetime "in_person_verification_pending_at" t.index ["fraud_pending_reason"], name: "index_profiles_on_fraud_pending_reason" t.index ["fraud_rejection_at"], name: "index_profiles_on_fraud_rejection_at" t.index ["fraud_review_pending_at"], name: "index_profiles_on_fraud_review_pending_at"