Browse Source

cbl, chr, cap

pull/79/head
Matthew Phelan 4 years ago committed by Kat
parent
commit
844ee206d2
  1. 7
      app/constants/db_enums.rb
  2. 9
      app/models/case_log.rb
  3. 16
      db/migrate/20211103090530_change_field_types.rb
  4. 11
      db/schema.rb

7
app/constants/db_enums.rb

@ -147,4 +147,11 @@ module DbEnums
"Yes" => 1, "Yes" => 1,
} }
end end
def self.polar2
{
"No" => 2,
"Yes" => 1,
}
end
end end

9
app/models/case_log.rb

@ -82,6 +82,15 @@ class CaseLog < ApplicationRecord
enum illness_type_9: DbEnums.polar, _suffix: true enum illness_type_9: DbEnums.polar, _suffix: true
enum illness_type_10: DbEnums.polar, _suffix: true enum illness_type_10: DbEnums.polar, _suffix: true
enum rp_homeless: DbEnums.polar, _suffix: true
enum rp_insan_unsat: DbEnums.polar, _suffix: true
enum rp_medwel: DbEnums.polar, _suffix: true
enum rp_hardship: DbEnums.polar, _suffix: true
enum rp_dontknow: DbEnums.polar, _suffix: true
enum cbl: DbEnums.polar2, _suffix: true
enum chr: DbEnums.polar2, _suffix: true
enum cap: DbEnums.polar2, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze
def self.editable_fields def self.editable_fields

16
db/migrate/20211103090530_change_field_types.rb

@ -34,6 +34,14 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :illness_type_8, "integer USING illness_type_8::integer" t.change :illness_type_8, "integer USING illness_type_8::integer"
t.change :illness_type_9, "integer USING illness_type_9::integer" t.change :illness_type_9, "integer USING illness_type_9::integer"
t.change :illness_type_10, "integer USING illness_type_10::integer" t.change :illness_type_10, "integer USING illness_type_10::integer"
t.change :rp_homeless, "integer USING rp_homeless::integer"
t.change :rp_insan_unsat, "integer USING rp_insan_unsat::integer"
t.change :rp_medwel, "integer USING rp_medwel::integer"
t.change :rp_hardship, "integer USING rp_hardship::integer"
t.change :rp_dontknow, "integer USING rp_dontknow::integer"
t.change :cbl, "integer USING cbl::integer"
t.change :chr, "integer USING chr::integer"
t.change :cap, "integer USING cap::integer"
end end
end end
@ -72,6 +80,14 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :illness_type_8, "boolean USING illness_type_8::boolean" t.change :illness_type_8, "boolean USING illness_type_8::boolean"
t.change :illness_type_9, "boolean USING illness_type_9::boolean" t.change :illness_type_9, "boolean USING illness_type_9::boolean"
t.change :illness_type_10, "boolean USING illness_type_10::boolean" t.change :illness_type_10, "boolean USING illness_type_10::boolean"
t.column :reasonable_preference_reason_homeless, :boolean
t.column :reasonable_preference_reason_unsatisfactory_housing, :boolean
t.column :reasonable_preference_reason_medical_grounds, :boolean
t.column :reasonable_preference_reason_avoid_hardship, :boolean
t.column :reasonable_preference_reason_do_not_know, :boolean
t.column :cbl_letting, :string
t.column :chr_letting, :string
t.column :cap_letting, :string
end end
end end
end end

11
db/schema.rb

@ -84,7 +84,6 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.string "property_void_date" t.string "property_void_date"
t.string "property_major_repairs" t.string "property_major_repairs"
t.string "property_major_repairs_date" t.string "property_major_repairs_date"
t.integer "offered"
t.string "wchair" t.string "wchair"
t.integer "earnings" t.integer "earnings"
t.string "incfreq" t.string "incfreq"
@ -103,9 +102,9 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.string "property_postcode" t.string "property_postcode"
t.string "reasonpref" t.string "reasonpref"
t.string "reasonable_preference_reason" t.string "reasonable_preference_reason"
t.string "cbl" t.integer "cbl"
t.string "chr" t.integer "chr"
t.string "cap" t.integer "cap"
t.string "outstanding_rent_or_charges" t.string "outstanding_rent_or_charges"
t.string "other_reason_for_leaving_last_settled_home" t.string "other_reason_for_leaving_last_settled_home"
t.integer "housingneeds_a" t.integer "housingneeds_a"
@ -131,10 +130,14 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.boolean "rp_medwel" t.boolean "rp_medwel"
t.boolean "rp_hardship" t.boolean "rp_hardship"
t.boolean "rp_dontknow" t.boolean "rp_dontknow"
t.integer "offered"
t.datetime "discarded_at" t.datetime "discarded_at"
t.boolean "override_net_income_validation" t.boolean "override_net_income_validation"
t.string "tenancyother" t.string "tenancyother"
t.string "net_income_known" t.string "net_income_known"
t.string "cbl_letting"
t.string "chr_letting"
t.string "cap_letting"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
end end

Loading…
Cancel
Save