From 8fe59def9b965caa69e00d0d6337d61d9f9f6fb6 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Thu, 10 Nov 2022 16:38:18 +0000 Subject: [PATCH] feat: remove unneccessary db field --- app/models/scheme.rb | 4 +++- ...47_add_second_deactivation_field_to_schemes.rb | 7 ------- ...110163351_add_deactivation_date_to_schemes.rb} | 0 db/schema.rb | 15 +++++++-------- 4 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 db/migrate/20221110111447_add_second_deactivation_field_to_schemes.rb rename db/migrate/{20221109095650_add_deactivation_date_to_schemes.rb => 20221110163351_add_deactivation_date_to_schemes.rb} (100%) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index f1925a188..784605a9d 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -21,6 +21,8 @@ class Scheme < ApplicationRecord auto_strip_attributes :service_name + attr_accessor :deactivation_date_type + SENSITIVE = { No: 0, Yes: 1, @@ -196,7 +198,7 @@ class Scheme < ApplicationRecord end def validate_confirmed - required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units has_other_client_group deactivation_date_type] + required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units has_other_client_group deactivation_date] if confirmed == true required_attributes.any? do |attribute| diff --git a/db/migrate/20221110111447_add_second_deactivation_field_to_schemes.rb b/db/migrate/20221110111447_add_second_deactivation_field_to_schemes.rb deleted file mode 100644 index 208c4b013..000000000 --- a/db/migrate/20221110111447_add_second_deactivation_field_to_schemes.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddSecondDeactivationFieldToSchemes < ActiveRecord::Migration[7.0] - def change - change_table :schemes, bulk: true do |t| - t.column :deactivation_date_type, :integer - end - end -end diff --git a/db/migrate/20221109095650_add_deactivation_date_to_schemes.rb b/db/migrate/20221110163351_add_deactivation_date_to_schemes.rb similarity index 100% rename from db/migrate/20221109095650_add_deactivation_date_to_schemes.rb rename to db/migrate/20221110163351_add_deactivation_date_to_schemes.rb diff --git a/db/schema.rb b/db/schema.rb index 7d0fafc9a..991a31264 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: 2022_11_10_111447) do +ActiveRecord::Schema[7.0].define(version: 2022_11_10_163351) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -359,12 +359,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_10_111447) do t.integer "hholdcount" t.integer "age3" t.integer "age3_known" - t.integer "age4" - t.integer "age4_known" - t.integer "age5" - t.integer "age5_known" - t.integer "age6" - t.integer "age6_known" t.string "la" t.integer "la_known" t.integer "income1" @@ -372,6 +366,12 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_10_111447) do t.integer "details_known_2" t.integer "details_known_3" t.integer "details_known_4" + t.integer "age4" + t.integer "age4_known" + t.integer "age5" + t.integer "age5_known" + t.integer "age6" + t.integer "age6_known" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id" @@ -398,7 +398,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_10_111447) do t.integer "total_units" t.boolean "confirmed" t.datetime "deactivation_date" - t.integer "deactivation_date_type" t.index ["managing_organisation_id"], name: "index_schemes_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_schemes_on_owning_organisation_id" end