From 9c2ab4397511cbf1d133151bd947556e1b16a256 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 26 Sep 2023 17:26:29 +0100 Subject: [PATCH] Remove state column This removes the column from all the requestables as we're no longer using it for anything and it can be safely removed. --- app/models/further_information_request.rb | 1 - app/models/professional_standing_request.rb | 1 - app/models/qualification_request.rb | 1 - app/models/reference_request.rb | 1 - config/analytics.yml | 4 ---- ...26162102_remove_state_from_requestables.rb | 24 +++++++++++++++++++ db/schema.rb | 6 +---- .../factories/further_information_requests.rb | 1 - .../professional_standing_requests.rb | 1 - spec/factories/qualification_requests.rb | 1 - spec/factories/reference_requests.rb | 1 - ...nal_standing_request_location_form_spec.rb | 8 ------- .../qualification_request_form_spec.rb | 8 ------- .../further_information_request_spec.rb | 1 - .../professional_standing_request_spec.rb | 1 - spec/models/qualification_request_spec.rb | 1 - spec/models/reference_request_spec.rb | 1 - 17 files changed, 25 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20230926162102_remove_state_from_requestables.rb diff --git a/app/models/further_information_request.rb b/app/models/further_information_request.rb index c088cff408..65996c75c5 100644 --- a/app/models/further_information_request.rb +++ b/app/models/further_information_request.rb @@ -9,7 +9,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # working_days_assessment_started_to_creation :integer # working_days_received_to_recommendation :integer # working_days_since_received :integer diff --git a/app/models/professional_standing_request.rb b/app/models/professional_standing_request.rb index 459d64b5ca..6f8454438c 100644 --- a/app/models/professional_standing_request.rb +++ b/app/models/professional_standing_request.rb @@ -13,7 +13,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/app/models/qualification_request.rb b/app/models/qualification_request.rb index e88088215e..a22cbf5301 100644 --- a/app/models/qualification_request.rb +++ b/app/models/qualification_request.rb @@ -12,7 +12,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/app/models/reference_request.rb b/app/models/reference_request.rb index d4d9034109..d024b03cf1 100644 --- a/app/models/reference_request.rb +++ b/app/models/reference_request.rb @@ -31,7 +31,6 @@ # satisfied_comment :text default(""), not null # satisfied_response :boolean # slug :string not null -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/config/analytics.yml b/config/analytics.yml index 17768a1e24..fba343ab5f 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -187,7 +187,6 @@ - received_at - requested_at - reviewed_at - - state - updated_at - working_days_assessment_started_to_creation - working_days_received_to_recommendation @@ -224,7 +223,6 @@ - received_at - requested_at - reviewed_at - - state - updated_at :qualifications: - id @@ -250,7 +248,6 @@ - received_at - requested_at - reviewed_at - - state - updated_at :reference_requests: - additional_information_response @@ -282,7 +279,6 @@ - satisfied_comment - satisfied_response - slug - - state - updated_at - work_history_id :regions: diff --git a/db/migrate/20230926162102_remove_state_from_requestables.rb b/db/migrate/20230926162102_remove_state_from_requestables.rb new file mode 100644 index 0000000000..30d24cc820 --- /dev/null +++ b/db/migrate/20230926162102_remove_state_from_requestables.rb @@ -0,0 +1,24 @@ +class RemoveStateFromRequestables < ActiveRecord::Migration[7.0] + def change + remove_column :further_information_requests, + :state, + type: :string, + null: false, + default: "requested" + remove_column :professional_standing_requests, + :state, + type: :string, + null: false, + default: "requested" + remove_column :qualification_requests, + :state, + type: :string, + null: false, + default: "requested" + remove_column :reference_requests, + :state, + type: :string, + null: false, + default: "requested" + end +end diff --git a/db/schema.rb b/db/schema.rb index 31123eff62..faf8984805 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_09_26_142509) do +ActiveRecord::Schema[7.0].define(version: 2023_09_26_162102) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -245,7 +245,6 @@ create_table "further_information_requests", force: :cascade do |t| t.bigint "assessment_id", null: false - t.string "state", default: "requested", null: false t.datetime "received_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -272,7 +271,6 @@ create_table "professional_standing_requests", force: :cascade do |t| t.bigint "assessment_id", null: false - t.string "state", default: "requested", null: false t.datetime "received_at" t.text "location_note", default: "", null: false t.datetime "created_at", null: false @@ -289,7 +287,6 @@ create_table "qualification_requests", force: :cascade do |t| t.bigint "assessment_id", null: false t.bigint "qualification_id", null: false - t.string "state", default: "requested", null: false t.datetime "received_at" t.text "location_note", default: "", null: false t.datetime "created_at", null: false @@ -321,7 +318,6 @@ t.string "slug", null: false t.bigint "assessment_id", null: false t.bigint "work_history_id", null: false - t.string "state", default: "requested", null: false t.datetime "received_at" t.boolean "dates_response" t.boolean "hours_response" diff --git a/spec/factories/further_information_requests.rb b/spec/factories/further_information_requests.rb index c626ca2dbb..99b626825a 100644 --- a/spec/factories/further_information_requests.rb +++ b/spec/factories/further_information_requests.rb @@ -11,7 +11,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # working_days_assessment_started_to_creation :integer # working_days_received_to_recommendation :integer # working_days_since_received :integer diff --git a/spec/factories/professional_standing_requests.rb b/spec/factories/professional_standing_requests.rb index 2656d89516..841565ad1f 100644 --- a/spec/factories/professional_standing_requests.rb +++ b/spec/factories/professional_standing_requests.rb @@ -13,7 +13,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/spec/factories/qualification_requests.rb b/spec/factories/qualification_requests.rb index b5836caa6c..2e65a99ac8 100644 --- a/spec/factories/qualification_requests.rb +++ b/spec/factories/qualification_requests.rb @@ -12,7 +12,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/spec/factories/reference_requests.rb b/spec/factories/reference_requests.rb index d0e2581227..15cbece673 100644 --- a/spec/factories/reference_requests.rb +++ b/spec/factories/reference_requests.rb @@ -31,7 +31,6 @@ # satisfied_comment :text default(""), not null # satisfied_response :boolean # slug :string not null -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb b/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb index e6629574ab..5393658f45 100644 --- a/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb +++ b/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb @@ -66,10 +66,6 @@ it { is_expected.to be true } - it "doesn't change the state" do - expect { save }.to_not change(requestable, :state) - end - it "sets ready for review" do expect { save }.to change(requestable, :ready_for_review).to(true) end @@ -81,10 +77,6 @@ it { is_expected.to be true } - it "doesn't change the state" do - expect { save }.to_not change(requestable, :state) - end - it "doesn't set ready for review" do expect { save }.to_not change(requestable, :ready_for_review) end diff --git a/spec/forms/assessor_interface/qualification_request_form_spec.rb b/spec/forms/assessor_interface/qualification_request_form_spec.rb index 7a7dd27ace..32aa4231ba 100644 --- a/spec/forms/assessor_interface/qualification_request_form_spec.rb +++ b/spec/forms/assessor_interface/qualification_request_form_spec.rb @@ -126,10 +126,6 @@ it { is_expected.to be true } - it "doesn't change the state" do - expect { save }.to_not change(requestable, :state) - end - it "sets passed" do expect { save }.to change(requestable, :passed).to(false) end @@ -149,10 +145,6 @@ it { is_expected.to be true } - it "doesn't change the state" do - expect { save }.to_not change(requestable, :state) - end - it "doesn't set passed" do expect { save }.to_not change(requestable, :passed) end diff --git a/spec/models/further_information_request_spec.rb b/spec/models/further_information_request_spec.rb index df05a4062e..54bda9b9a1 100644 --- a/spec/models/further_information_request_spec.rb +++ b/spec/models/further_information_request_spec.rb @@ -11,7 +11,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # working_days_assessment_started_to_creation :integer # working_days_received_to_recommendation :integer # working_days_since_received :integer diff --git a/spec/models/professional_standing_request_spec.rb b/spec/models/professional_standing_request_spec.rb index 566a321820..571eb47a77 100644 --- a/spec/models/professional_standing_request_spec.rb +++ b/spec/models/professional_standing_request_spec.rb @@ -13,7 +13,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/spec/models/qualification_request_spec.rb b/spec/models/qualification_request_spec.rb index ee9de4621f..c70509a484 100644 --- a/spec/models/qualification_request_spec.rb +++ b/spec/models/qualification_request_spec.rb @@ -12,7 +12,6 @@ # received_at :datetime # requested_at :datetime # reviewed_at :datetime -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null diff --git a/spec/models/reference_request_spec.rb b/spec/models/reference_request_spec.rb index 5d2c602817..adc83081b8 100644 --- a/spec/models/reference_request_spec.rb +++ b/spec/models/reference_request_spec.rb @@ -31,7 +31,6 @@ # satisfied_comment :text default(""), not null # satisfied_response :boolean # slug :string not null -# state :string default("requested"), not null # created_at :datetime not null # updated_at :datetime not null # assessment_id :bigint not null