From 8617e17199ebec07416e9238a181f2ecb0a856b8 Mon Sep 17 00:00:00 2001 From: CL Fisher Date: Tue, 7 Oct 2025 11:53:37 -0400 Subject: [PATCH 1/2] cleaning up partner profile cleaning up partner profile --- app/controllers/profiles_controller.rb | 10 -------- app/models/partners/profile.rb | 19 ++++----------- app/models/user.rb | 1 - .../20251007141240_unused_fields_cleanup.rb | 24 +++++++++++++++++++ db/schema.rb | 12 +--------- spec/factories/partners/profiles.rb | 3 +++ spec/models/partners/profile_spec.rb | 3 +++ 7 files changed, 35 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20251007141240_unused_fields_cleanup.rb diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 4f424f2a3a..abc13df215 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -69,28 +69,20 @@ def edit_profile_params :program_age, :case_management, :evidence_based, - :evidence_based_description, :program_client_improvement, :essentials_use, :receives_essentials_from_other, :currently_provide_diapers, - :turn_away_child_care, :program_address1, :program_address2, :program_city, :program_state, :program_zip_code, :client_capacity, - :incorporate_plan, - :responsible_staff_position, :storage_space, :describe_storage_space, - :trusted_pickup, :income_requirement_desc, - :serve_income_circumstances, :income_verification, - :internal_db, - :maac, :population_black, :population_white, :population_hispanic, @@ -104,7 +96,6 @@ def edit_profile_params :above_1_2_times_fpl, :greater_2_times_fpl, :poverty_unknown, - :ages_served, :executive_director_name, :executive_director_phone, :executive_director_email, @@ -112,7 +103,6 @@ def edit_profile_params :primary_contact_phone, :primary_contact_mobile, :primary_contact_email, - :pick_up_method, :pick_up_name, :pick_up_phone, :pick_up_email, diff --git a/app/models/partners/profile.rb b/app/models/partners/profile.rb index 9b7100c188..1d8d2fc311 100644 --- a/app/models/partners/profile.rb +++ b/app/models/partners/profile.rb @@ -8,6 +8,7 @@ # address2 :string # agency_mission :text # agency_type :string +# application_data :text # at_fpl_or_below :integer # case_management :boolean # city :string @@ -15,6 +16,7 @@ # currently_provide_diapers :boolean # describe_storage_space :text # distribution_times :string +# distributor_type :string # enable_child_based_requests :boolean default(TRUE), not null # enable_individual_requests :boolean default(TRUE), not null # enable_quantity_based_requests :boolean default(TRUE), not null @@ -57,6 +59,7 @@ # program_address2 :string # program_age :string # program_city :string +# program_client_improvement :text # program_description :text # program_name :string # program_state :string @@ -176,21 +179,7 @@ class Profile < Base # These are columns which currently do not appear in any partial of the profile form. # It is possible these will be removed in the future. - self.ignored_columns += %w[ - application_data - distributor_type - evidence_based_description - program_client_improvement - incorporate_plan - turn_away_child_care - responsible_staff_position - trusted_pickup - serve_income_circumstances - internal_db - maac - pick_up_method - ages_served - ] + def client_share_total # client_share could be nil diff --git a/app/models/user.rb b/app/models/user.rb index b032ae3ece..afffdd4889 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -20,7 +20,6 @@ # last_sign_in_ip :inet # name :string # organization_admin :boolean -# pending_role_invites :text # provider :string # remember_created_at :datetime # reset_password_sent_at :datetime diff --git a/db/migrate/20251007141240_unused_fields_cleanup.rb b/db/migrate/20251007141240_unused_fields_cleanup.rb new file mode 100644 index 0000000000..22d2a4b7a2 --- /dev/null +++ b/db/migrate/20251007141240_unused_fields_cleanup.rb @@ -0,0 +1,24 @@ +class UnusedFieldsCleanup < ActiveRecord::Migration[8.0] + def change + safety_assured do + # removing columns that were removed from user interface in 2022 + remove_column :partner_profiles, :evidence_based_description + remove_column :partner_profiles, :turn_away_child_care + remove_column :partner_profiles, :incorporate_plan + remove_column :partner_profiles, :responsible_staff_position + remove_column :partner_profiles, :trusted_pickup + remove_column :partner_profiles, :serve_income_circumstances + remove_column :partner_profiles, :internal_db + remove_column :partner_profiles, :maac + remove_column :partner_profiles, :pick_up_method + remove_column :partner_profiles, :ages_served + # Note: "verified successes of program" was listed in the columns to be removed, but not found in the db I think it's program_client_improvement, below + # These three columns were noted as "ignored columns" in profile.rb, and check out as far as no recent data in production (application_data and distributor_type are empty, + # and program_client_improveement has no data since 2022) + remove_column :partner_profiles, :application_data + remove_column :partner_profiles, :distributor_type + remove_column :partner_profiles, :program_client_improvement + end + + end +end diff --git a/db/schema.rb b/db/schema.rb index fbab5b8d6d..ee6d39e7b6 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[8.0].define(version: 2025_09_13_173217) do +ActiveRecord::Schema[8.0].define(version: 2025_10_07_141240) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -569,28 +569,20 @@ t.string "program_age" t.boolean "case_management" t.boolean "evidence_based" - t.text "evidence_based_description" t.text "program_client_improvement" t.string "essentials_use" t.string "receives_essentials_from_other" t.boolean "currently_provide_diapers" - t.boolean "turn_away_child_care" t.string "program_address1" t.string "program_address2" t.string "program_city" t.string "program_state" t.integer "program_zip_code" t.string "client_capacity" - t.text "incorporate_plan" - t.boolean "responsible_staff_position" t.boolean "storage_space" t.text "describe_storage_space" - t.boolean "trusted_pickup" t.boolean "income_requirement_desc" - t.boolean "serve_income_circumstances" t.boolean "income_verification" - t.boolean "internal_db" - t.boolean "maac" t.integer "population_black" t.integer "population_white" t.integer "population_hispanic" @@ -604,7 +596,6 @@ t.integer "above_1_2_times_fpl" t.integer "greater_2_times_fpl" t.integer "poverty_unknown" - t.string "ages_served" t.string "executive_director_name" t.string "executive_director_phone" t.string "executive_director_email" @@ -612,7 +603,6 @@ t.string "primary_contact_phone" t.string "primary_contact_mobile" t.string "primary_contact_email" - t.string "pick_up_method" t.string "pick_up_name" t.string "pick_up_phone" t.string "pick_up_email" diff --git a/spec/factories/partners/profiles.rb b/spec/factories/partners/profiles.rb index 3d36ae536e..cb6d1b0005 100644 --- a/spec/factories/partners/profiles.rb +++ b/spec/factories/partners/profiles.rb @@ -8,6 +8,7 @@ # address2 :string # agency_mission :text # agency_type :string +# application_data :text # at_fpl_or_below :integer # case_management :boolean # city :string @@ -15,6 +16,7 @@ # currently_provide_diapers :boolean # describe_storage_space :text # distribution_times :string +# distributor_type :string # enable_child_based_requests :boolean default(TRUE), not null # enable_individual_requests :boolean default(TRUE), not null # enable_quantity_based_requests :boolean default(TRUE), not null @@ -57,6 +59,7 @@ # program_address2 :string # program_age :string # program_city :string +# program_client_improvement :text # program_description :text # program_name :string # program_state :string diff --git a/spec/models/partners/profile_spec.rb b/spec/models/partners/profile_spec.rb index 5d3a4ae7ae..687b51fd9c 100644 --- a/spec/models/partners/profile_spec.rb +++ b/spec/models/partners/profile_spec.rb @@ -8,6 +8,7 @@ # address2 :string # agency_mission :text # agency_type :string +# application_data :text # at_fpl_or_below :integer # case_management :boolean # city :string @@ -15,6 +16,7 @@ # currently_provide_diapers :boolean # describe_storage_space :text # distribution_times :string +# distributor_type :string # enable_child_based_requests :boolean default(TRUE), not null # enable_individual_requests :boolean default(TRUE), not null # enable_quantity_based_requests :boolean default(TRUE), not null @@ -57,6 +59,7 @@ # program_address2 :string # program_age :string # program_city :string +# program_client_improvement :text # program_description :text # program_name :string # program_state :string From 1b5d00f4d48616355d0957dddf045fe0b551c853 Mon Sep 17 00:00:00 2001 From: CL Fisher Date: Tue, 7 Oct 2025 12:32:28 -0400 Subject: [PATCH 2/2] making rubocop happy --- app/models/partners/profile.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/partners/profile.rb b/app/models/partners/profile.rb index 1d8d2fc311..541c5ac24a 100644 --- a/app/models/partners/profile.rb +++ b/app/models/partners/profile.rb @@ -180,7 +180,6 @@ class Profile < Base # These are columns which currently do not appear in any partial of the profile form. # It is possible these will be removed in the future. - def client_share_total # client_share could be nil served_areas.map(&:client_share).compact.sum