From 8a4a9343deaef0595bae52e5dbd260e4ae5043a7 Mon Sep 17 00:00:00 2001 From: Vanson Samuel <37637+binq@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:29:55 -0500 Subject: [PATCH] database updates (#16475) --- ..._remove_ssn_and_icn_from_vye_tables.vye.rb | 20 +++++++ ...address_details_from_vye_user_infos.vye.rb | 17 ++++++ ...40424132508_change_datetime_to_date.vye.rb | 16 ++++++ ...20240424132509_update_verifications.vye.rb | 15 +++++ ...0240424132510_create_vye_bdn_clones.vye.rb | 15 +++++ ...0240424132511_add_to_vye_user_infos.vye.rb | 14 +++++ ...12_remove_from_vye_pending_document.vye.rb | 8 +++ db/schema.rb | 56 ++++++++++--------- ...5700_remove_ssn_and_icn_from_vye_tables.rb | 19 +++++++ ...ove_address_details_from_vye_user_infos.rb | 16 ++++++ .../20240415205522_change_datetime_to_date.rb | 15 +++++ .../20240415220728_update_verifications.rb | 14 +++++ .../20240422033815_create_vye_bdn_clones.rb | 14 +++++ .../20240422043836_add_to_vye_user_infos.rb | 13 +++++ ...051918_remove_from_vye_pending_document.rb | 7 +++ 15 files changed, 234 insertions(+), 25 deletions(-) create mode 100644 db/migrate/20240424132506_remove_ssn_and_icn_from_vye_tables.vye.rb create mode 100644 db/migrate/20240424132507_remove_address_details_from_vye_user_infos.vye.rb create mode 100644 db/migrate/20240424132508_change_datetime_to_date.vye.rb create mode 100644 db/migrate/20240424132509_update_verifications.vye.rb create mode 100644 db/migrate/20240424132510_create_vye_bdn_clones.vye.rb create mode 100644 db/migrate/20240424132511_add_to_vye_user_infos.vye.rb create mode 100644 db/migrate/20240424132512_remove_from_vye_pending_document.vye.rb create mode 100644 modules/vye/db/migrate/20240303145700_remove_ssn_and_icn_from_vye_tables.rb create mode 100644 modules/vye/db/migrate/20240305034315_remove_address_details_from_vye_user_infos.rb create mode 100644 modules/vye/db/migrate/20240415205522_change_datetime_to_date.rb create mode 100644 modules/vye/db/migrate/20240415220728_update_verifications.rb create mode 100644 modules/vye/db/migrate/20240422033815_create_vye_bdn_clones.rb create mode 100644 modules/vye/db/migrate/20240422043836_add_to_vye_user_infos.rb create mode 100644 modules/vye/db/migrate/20240422051918_remove_from_vye_pending_document.rb diff --git a/db/migrate/20240424132506_remove_ssn_and_icn_from_vye_tables.vye.rb b/db/migrate/20240424132506_remove_ssn_and_icn_from_vye_tables.vye.rb new file mode 100644 index 00000000000..f2fe7877b21 --- /dev/null +++ b/db/migrate/20240424132506_remove_ssn_and_icn_from_vye_tables.vye.rb @@ -0,0 +1,20 @@ +# This migration comes from vye (originally 20240303145700) +class RemoveSsnAndIcnFromVyeTables < ActiveRecord::Migration[7.0] + def change + safety_assured do + remove_columns( + :vye_user_infos, + :icn, + :ssn_ciphertext, + :ssn_digest + ) + + remove_columns( + :vye_pending_documents, + :claim_no_ciphertext, + :ssn_ciphertext, + :ssn_digest + ) + end + end +end diff --git a/db/migrate/20240424132507_remove_address_details_from_vye_user_infos.vye.rb b/db/migrate/20240424132507_remove_address_details_from_vye_user_infos.vye.rb new file mode 100644 index 00000000000..42e3ef38cb9 --- /dev/null +++ b/db/migrate/20240424132507_remove_address_details_from_vye_user_infos.vye.rb @@ -0,0 +1,17 @@ +# This migration comes from vye (originally 20240305034315) +class RemoveAddressDetailsFromVyeUserInfos < ActiveRecord::Migration[7.0] + def change + safety_assured do + remove_columns( + :vye_user_infos, + :full_name_ciphertext, + :address_line2_ciphertext, + :address_line3_ciphertext, + :address_line4_ciphertext, + :address_line5_ciphertext, + :address_line6_ciphertext, + :zip_ciphertext + ) + end + end +end diff --git a/db/migrate/20240424132508_change_datetime_to_date.vye.rb b/db/migrate/20240424132508_change_datetime_to_date.vye.rb new file mode 100644 index 00000000000..c8231dac316 --- /dev/null +++ b/db/migrate/20240424132508_change_datetime_to_date.vye.rb @@ -0,0 +1,16 @@ +# This migration comes from vye (originally 20240415205522) +class ChangeDatetimeToDate < ActiveRecord::Migration[7.1] + def change + safety_assured do + change_column :vye_awards, :award_begin_date, :date + change_column :vye_awards, :award_end_date, :date + change_column :vye_awards, :payment_date, :date + + change_column :vye_pending_documents, :queue_date, :date + + change_column :vye_user_infos, :cert_issue_date, :date + change_column :vye_user_infos, :del_date, :date + change_column :vye_user_infos, :date_last_certified, :date + end + end +end diff --git a/db/migrate/20240424132509_update_verifications.vye.rb b/db/migrate/20240424132509_update_verifications.vye.rb new file mode 100644 index 00000000000..163cefe3b10 --- /dev/null +++ b/db/migrate/20240424132509_update_verifications.vye.rb @@ -0,0 +1,15 @@ +# This migration comes from vye (originally 20240415220728) +class UpdateVerifications < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_column :vye_verifications, :user_profile_id, :integer + add_column :vye_verifications, :monthly_rate, :decimal + add_column :vye_verifications, :number_hours, :integer + add_column :vye_verifications, :payment_date, :date + add_column :vye_verifications, :transact_date, :date + add_column :vye_verifications, :trace, :string + + add_index :vye_verifications, :user_profile_id, algorithm: :concurrently + end +end diff --git a/db/migrate/20240424132510_create_vye_bdn_clones.vye.rb b/db/migrate/20240424132510_create_vye_bdn_clones.vye.rb new file mode 100644 index 00000000000..e6ae09aeeae --- /dev/null +++ b/db/migrate/20240424132510_create_vye_bdn_clones.vye.rb @@ -0,0 +1,15 @@ +# This migration comes from vye (originally 20240422033815) +class CreateVyeBdnClones < ActiveRecord::Migration[7.1] + def change + create_table :vye_bdn_clones do |t| + t.boolean :is_active + t.boolean :export_ready + t.date :transact_date + + t.timestamps + end + + add_index :vye_bdn_clones, :is_active, unique: true, where: "is_active IS NOT NULL" + add_index :vye_bdn_clones, :export_ready, unique: true, where: "export_ready IS NOT NULL" + end +end diff --git a/db/migrate/20240424132511_add_to_vye_user_infos.vye.rb b/db/migrate/20240424132511_add_to_vye_user_infos.vye.rb new file mode 100644 index 00000000000..f7a66eec657 --- /dev/null +++ b/db/migrate/20240424132511_add_to_vye_user_infos.vye.rb @@ -0,0 +1,14 @@ +# This migration comes from vye (originally 20240422043836) +class AddToVyeUserInfos < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_column :vye_user_infos, :bdn_clone_id, :integer + add_column :vye_user_infos, :bdn_clone_line, :integer + add_column :vye_user_infos, :bdn_clone_active, :boolean + + add_index :vye_user_infos, :bdn_clone_id, algorithm: :concurrently + add_index :vye_user_infos, :bdn_clone_line, algorithm: :concurrently + add_index :vye_user_infos, :bdn_clone_active, algorithm: :concurrently + end +end diff --git a/db/migrate/20240424132512_remove_from_vye_pending_document.vye.rb b/db/migrate/20240424132512_remove_from_vye_pending_document.vye.rb new file mode 100644 index 00000000000..f430386e073 --- /dev/null +++ b/db/migrate/20240424132512_remove_from_vye_pending_document.vye.rb @@ -0,0 +1,8 @@ +# This migration comes from vye (originally 20240422051918) +class RemoveFromVyePendingDocument < ActiveRecord::Migration[7.1] + def change + safety_assured do + remove_column :vye_pending_documents, :encrypted_kms_key + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 8ef34f9a216..9db62d367e7 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.1].define(version: 2024_04_17_130647) do +ActiveRecord::Schema[7.1].define(version: 2024_04_24_132512) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_stat_statements" @@ -1369,10 +1369,10 @@ create_table "vye_awards", force: :cascade do |t| t.integer "user_info_id" t.string "cur_award_ind" - t.datetime "award_begin_date" - t.datetime "award_end_date" + t.date "award_begin_date" + t.date "award_end_date" t.integer "training_time" - t.datetime "payment_date" + t.date "payment_date" t.decimal "monthly_rate" t.string "begin_rsn" t.string "end_rsn" @@ -1384,6 +1384,16 @@ t.index ["user_info_id"], name: "index_vye_awards_on_user_info_id" end + create_table "vye_bdn_clones", force: :cascade do |t| + t.boolean "is_active" + t.boolean "export_ready" + t.date "transact_date" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["export_ready"], name: "index_vye_bdn_clones_on_export_ready", unique: true, where: "(export_ready IS NOT NULL)" + t.index ["is_active"], name: "index_vye_bdn_clones_on_is_active", unique: true, where: "(is_active IS NOT NULL)" + end + create_table "vye_direct_deposit_changes", force: :cascade do |t| t.integer "user_info_id" t.string "rpo" @@ -1405,39 +1415,24 @@ end create_table "vye_pending_documents", force: :cascade do |t| - t.string "ssn_digest" - t.text "ssn_ciphertext" - t.string "claim_no_ciphertext" t.string "doc_type" - t.datetime "queue_date" + t.date "queue_date" t.string "rpo" - t.text "encrypted_kms_key" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "user_profile_id" - t.index ["ssn_digest"], name: "index_vye_pending_documents_on_ssn_digest" end create_table "vye_user_infos", force: :cascade do |t| - t.string "icn" - t.string "ssn_digest" - t.text "ssn_ciphertext" t.text "file_number_ciphertext" t.string "suffix" - t.text "full_name_ciphertext" - t.text "address_line2_ciphertext" - t.text "address_line3_ciphertext" - t.text "address_line4_ciphertext" - t.text "address_line5_ciphertext" - t.text "address_line6_ciphertext" - t.text "zip_ciphertext" t.text "dob_ciphertext" t.text "stub_nm_ciphertext" t.string "mr_status" t.string "rem_ent" - t.datetime "cert_issue_date" - t.datetime "del_date" - t.datetime "date_last_certified" + t.date "cert_issue_date" + t.date "del_date" + t.date "date_last_certified" t.integer "rpo_code" t.string "fac_code" t.decimal "payment_amt" @@ -1446,8 +1441,12 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "user_profile_id" - t.index ["icn"], name: "index_vye_user_infos_on_icn" - t.index ["ssn_digest"], name: "index_vye_user_infos_on_ssn_digest" + t.integer "bdn_clone_id" + t.integer "bdn_clone_line" + t.boolean "bdn_clone_active" + t.index ["bdn_clone_active"], name: "index_vye_user_infos_on_bdn_clone_active" + t.index ["bdn_clone_id"], name: "index_vye_user_infos_on_bdn_clone_id" + t.index ["bdn_clone_line"], name: "index_vye_user_infos_on_bdn_clone_line" end create_table "vye_user_profiles", force: :cascade do |t| @@ -1472,7 +1471,14 @@ t.string "source_ind" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "user_profile_id" + t.decimal "monthly_rate" + t.integer "number_hours" + t.date "payment_date" + t.date "transact_date" + t.string "trace" t.index ["user_info_id"], name: "index_vye_verifications_on_user_info_id" + t.index ["user_profile_id"], name: "index_vye_verifications_on_user_profile_id" end create_table "webhooks_notification_attempt_assocs", id: false, force: :cascade do |t| diff --git a/modules/vye/db/migrate/20240303145700_remove_ssn_and_icn_from_vye_tables.rb b/modules/vye/db/migrate/20240303145700_remove_ssn_and_icn_from_vye_tables.rb new file mode 100644 index 00000000000..60e78894fe5 --- /dev/null +++ b/modules/vye/db/migrate/20240303145700_remove_ssn_and_icn_from_vye_tables.rb @@ -0,0 +1,19 @@ +class RemoveSsnAndIcnFromVyeTables < ActiveRecord::Migration[7.0] + def change + safety_assured do + remove_columns( + :vye_user_infos, + :icn, + :ssn_ciphertext, + :ssn_digest + ) + + remove_columns( + :vye_pending_documents, + :claim_no_ciphertext, + :ssn_ciphertext, + :ssn_digest + ) + end + end +end diff --git a/modules/vye/db/migrate/20240305034315_remove_address_details_from_vye_user_infos.rb b/modules/vye/db/migrate/20240305034315_remove_address_details_from_vye_user_infos.rb new file mode 100644 index 00000000000..f565b836ffb --- /dev/null +++ b/modules/vye/db/migrate/20240305034315_remove_address_details_from_vye_user_infos.rb @@ -0,0 +1,16 @@ +class RemoveAddressDetailsFromVyeUserInfos < ActiveRecord::Migration[7.0] + def change + safety_assured do + remove_columns( + :vye_user_infos, + :full_name_ciphertext, + :address_line2_ciphertext, + :address_line3_ciphertext, + :address_line4_ciphertext, + :address_line5_ciphertext, + :address_line6_ciphertext, + :zip_ciphertext + ) + end + end +end diff --git a/modules/vye/db/migrate/20240415205522_change_datetime_to_date.rb b/modules/vye/db/migrate/20240415205522_change_datetime_to_date.rb new file mode 100644 index 00000000000..849c162cb1a --- /dev/null +++ b/modules/vye/db/migrate/20240415205522_change_datetime_to_date.rb @@ -0,0 +1,15 @@ +class ChangeDatetimeToDate < ActiveRecord::Migration[7.1] + def change + safety_assured do + change_column :vye_awards, :award_begin_date, :date + change_column :vye_awards, :award_end_date, :date + change_column :vye_awards, :payment_date, :date + + change_column :vye_pending_documents, :queue_date, :date + + change_column :vye_user_infos, :cert_issue_date, :date + change_column :vye_user_infos, :del_date, :date + change_column :vye_user_infos, :date_last_certified, :date + end + end +end diff --git a/modules/vye/db/migrate/20240415220728_update_verifications.rb b/modules/vye/db/migrate/20240415220728_update_verifications.rb new file mode 100644 index 00000000000..0032f0ef130 --- /dev/null +++ b/modules/vye/db/migrate/20240415220728_update_verifications.rb @@ -0,0 +1,14 @@ +class UpdateVerifications < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_column :vye_verifications, :user_profile_id, :integer + add_column :vye_verifications, :monthly_rate, :decimal + add_column :vye_verifications, :number_hours, :integer + add_column :vye_verifications, :payment_date, :date + add_column :vye_verifications, :transact_date, :date + add_column :vye_verifications, :trace, :string + + add_index :vye_verifications, :user_profile_id, algorithm: :concurrently + end +end diff --git a/modules/vye/db/migrate/20240422033815_create_vye_bdn_clones.rb b/modules/vye/db/migrate/20240422033815_create_vye_bdn_clones.rb new file mode 100644 index 00000000000..289ac896503 --- /dev/null +++ b/modules/vye/db/migrate/20240422033815_create_vye_bdn_clones.rb @@ -0,0 +1,14 @@ +class CreateVyeBdnClones < ActiveRecord::Migration[7.1] + def change + create_table :vye_bdn_clones do |t| + t.boolean :is_active + t.boolean :export_ready + t.date :transact_date + + t.timestamps + end + + add_index :vye_bdn_clones, :is_active, unique: true, where: "is_active IS NOT NULL" + add_index :vye_bdn_clones, :export_ready, unique: true, where: "export_ready IS NOT NULL" + end +end diff --git a/modules/vye/db/migrate/20240422043836_add_to_vye_user_infos.rb b/modules/vye/db/migrate/20240422043836_add_to_vye_user_infos.rb new file mode 100644 index 00000000000..23b81278a0f --- /dev/null +++ b/modules/vye/db/migrate/20240422043836_add_to_vye_user_infos.rb @@ -0,0 +1,13 @@ +class AddToVyeUserInfos < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_column :vye_user_infos, :bdn_clone_id, :integer + add_column :vye_user_infos, :bdn_clone_line, :integer + add_column :vye_user_infos, :bdn_clone_active, :boolean + + add_index :vye_user_infos, :bdn_clone_id, algorithm: :concurrently + add_index :vye_user_infos, :bdn_clone_line, algorithm: :concurrently + add_index :vye_user_infos, :bdn_clone_active, algorithm: :concurrently + end +end diff --git a/modules/vye/db/migrate/20240422051918_remove_from_vye_pending_document.rb b/modules/vye/db/migrate/20240422051918_remove_from_vye_pending_document.rb new file mode 100644 index 00000000000..0b87976e9aa --- /dev/null +++ b/modules/vye/db/migrate/20240422051918_remove_from_vye_pending_document.rb @@ -0,0 +1,7 @@ +class RemoveFromVyePendingDocument < ActiveRecord::Migration[7.1] + def change + safety_assured do + remove_column :vye_pending_documents, :encrypted_kms_key + end + end +end