From 8f3b81953b09214f3f90af0b575328491ce070ee Mon Sep 17 00:00:00 2001 From: Oren Mittman Date: Tue, 7 Jan 2025 10:48:26 -0500 Subject: [PATCH] 4: [ART] Make POA request and form adjustments migration (#19997) * 1 Removed old indices from ar_power_of_attorney_forms 2 Removed obsolete columns: city_bidx, state_bidx, zipcode_bidx 3 Added new columns: claimant_city_ciphertext, claimant_city_bidx, claimant_state_code_ciphertext, claimant_state_code_bidx, claimant_zip_code_ciphertext, claimant_zip_code_bidx 4 Added a new index for claimant_city_bidx, claimant_state_code_bidx, and claimant_zip_code_bidx 5 Added claimant_type column to ar_power_of_attorney_requests * (fix) rerun migrations and update db/schema.rb --------- Co-authored-by: OJ Bucao <9256675+ojbucao@users.noreply.github.com> --- db/schema.rb | 15 +++++++++------ ...227212839_remove_old_indices_from_poa_forms.rb | 6 ++++++ ...0241227212922_remove_columns_from_poa_forms.rb | 5 +++++ .../20241227212942_add_columns_to_poa_forms.rb | 12 ++++++++++++ .../20241227213018_add_new_index_to_poa_forms.rb | 9 +++++++++ ...227213059_add_claimant_type_to_poa_requests.rb | 5 +++++ 6 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 modules/accredited_representative_portal/db/migrate/20241227212839_remove_old_indices_from_poa_forms.rb create mode 100644 modules/accredited_representative_portal/db/migrate/20241227212922_remove_columns_from_poa_forms.rb create mode 100644 modules/accredited_representative_portal/db/migrate/20241227212942_add_columns_to_poa_forms.rb create mode 100644 modules/accredited_representative_portal/db/migrate/20241227213018_add_new_index_to_poa_forms.rb create mode 100644 modules/accredited_representative_portal/db/migrate/20241227213059_add_claimant_type_to_poa_requests.rb diff --git a/db/schema.rb b/db/schema.rb index 09c8727634f..afbf63271f4 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.2].define(version: 2024_12_20_164548) do +ActiveRecord::Schema[7.2].define(version: 2024_12_27_213059) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "fuzzystrmatch" @@ -273,12 +273,14 @@ t.uuid "power_of_attorney_request_id", null: false t.text "encrypted_kms_key" t.text "data_ciphertext", null: false - t.string "city_bidx", null: false - t.string "state_bidx", null: false - t.string "zipcode_bidx", null: false - t.index ["city_bidx", "state_bidx", "zipcode_bidx"], name: "idx_on_city_bidx_state_bidx_zipcode_bidx_a85b76f9bc" + t.string "claimant_city_ciphertext", null: false + t.string "claimant_city_bidx", null: false + t.string "claimant_state_code_ciphertext", null: false + t.string "claimant_state_code_bidx", null: false + t.string "claimant_zip_code_ciphertext", null: false + t.string "claimant_zip_code_bidx", null: false + t.index ["claimant_city_bidx", "claimant_state_code_bidx", "claimant_zip_code_bidx"], name: "idx_on_claimant_city_bidx_claimant_state_code_bidx__11e9adbe25" t.index ["power_of_attorney_request_id"], name: "idx_on_power_of_attorney_request_id_fc59a0dabc", unique: true - t.index ["zipcode_bidx"], name: "index_ar_power_of_attorney_forms_on_zipcode_bidx" end create_table "ar_power_of_attorney_request_decisions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -304,6 +306,7 @@ create_table "ar_power_of_attorney_requests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "claimant_id", null: false t.datetime "created_at", null: false + t.string "claimant_type", null: false t.index ["claimant_id"], name: "index_ar_power_of_attorney_requests_on_claimant_id" end diff --git a/modules/accredited_representative_portal/db/migrate/20241227212839_remove_old_indices_from_poa_forms.rb b/modules/accredited_representative_portal/db/migrate/20241227212839_remove_old_indices_from_poa_forms.rb new file mode 100644 index 00000000000..e0d142fcf36 --- /dev/null +++ b/modules/accredited_representative_portal/db/migrate/20241227212839_remove_old_indices_from_poa_forms.rb @@ -0,0 +1,6 @@ +class RemoveOldIndicesFromPoaForms < ActiveRecord::Migration[7.1] + def change + remove_index :ar_power_of_attorney_forms, name: 'idx_on_city_bidx_state_bidx_zipcode_bidx_a85b76f9bc', column: [:city_bidx, :state_bidx, :zipcode_bidx] + remove_index :ar_power_of_attorney_forms, name: 'index_ar_power_of_attorney_forms_on_zipcode_bidx', column: :zipcode_bidx + end +end diff --git a/modules/accredited_representative_portal/db/migrate/20241227212922_remove_columns_from_poa_forms.rb b/modules/accredited_representative_portal/db/migrate/20241227212922_remove_columns_from_poa_forms.rb new file mode 100644 index 00000000000..980aa3c57db --- /dev/null +++ b/modules/accredited_representative_portal/db/migrate/20241227212922_remove_columns_from_poa_forms.rb @@ -0,0 +1,5 @@ +class RemoveColumnsFromPoaForms < ActiveRecord::Migration[7.1] + def change + safety_assured { remove_columns :ar_power_of_attorney_forms, :city_bidx, :state_bidx, :zipcode_bidx, type: :string } + end +end diff --git a/modules/accredited_representative_portal/db/migrate/20241227212942_add_columns_to_poa_forms.rb b/modules/accredited_representative_portal/db/migrate/20241227212942_add_columns_to_poa_forms.rb new file mode 100644 index 00000000000..eb6ccded31c --- /dev/null +++ b/modules/accredited_representative_portal/db/migrate/20241227212942_add_columns_to_poa_forms.rb @@ -0,0 +1,12 @@ +class AddColumnsToPoaForms < ActiveRecord::Migration[7.1] + def change + add_column :ar_power_of_attorney_forms, :claimant_city_ciphertext, :string, null: false + add_column :ar_power_of_attorney_forms, :claimant_city_bidx, :string, null: false + + add_column :ar_power_of_attorney_forms, :claimant_state_code_ciphertext, :string, null: false + add_column :ar_power_of_attorney_forms, :claimant_state_code_bidx, :string, null: false + + add_column :ar_power_of_attorney_forms, :claimant_zip_code_ciphertext, :string, null: false + add_column :ar_power_of_attorney_forms, :claimant_zip_code_bidx, :string, null: false + end +end diff --git a/modules/accredited_representative_portal/db/migrate/20241227213018_add_new_index_to_poa_forms.rb b/modules/accredited_representative_portal/db/migrate/20241227213018_add_new_index_to_poa_forms.rb new file mode 100644 index 00000000000..27421549c74 --- /dev/null +++ b/modules/accredited_representative_portal/db/migrate/20241227213018_add_new_index_to_poa_forms.rb @@ -0,0 +1,9 @@ +class AddNewIndexToPoaForms < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :ar_power_of_attorney_forms, + [:claimant_city_bidx, :claimant_state_code_bidx, :claimant_zip_code_bidx], + algorithm: :concurrently + end +end diff --git a/modules/accredited_representative_portal/db/migrate/20241227213059_add_claimant_type_to_poa_requests.rb b/modules/accredited_representative_portal/db/migrate/20241227213059_add_claimant_type_to_poa_requests.rb new file mode 100644 index 00000000000..b8f1ae170bf --- /dev/null +++ b/modules/accredited_representative_portal/db/migrate/20241227213059_add_claimant_type_to_poa_requests.rb @@ -0,0 +1,5 @@ +class AddClaimantTypeToPoaRequests < ActiveRecord::Migration[7.1] + def change + add_column :ar_power_of_attorney_requests, :claimant_type, :string, null: false + end +end