Browse Source

Change more types

pull/79/head
Kat 4 years ago
parent
commit
7b2f27e04d
  1. 13
      app/constants/db_enums.rb
  2. 3
      app/models/case_log.rb
  3. 10
      db/migrate/20211103090530_change_field_types.rb
  4. 10
      db/schema.rb

13
app/constants/db_enums.rb

@ -236,4 +236,17 @@ module DbEnums
"Weekly for 53 weeks" => 10,
}
end
def self.latime
{
"Just moved to local authority area" => 1,
"Less than 1 year" => 2,
"1 to 2 years" => 7,
"2 to 3 years" => 8,
"3 to 4 years" => 9,
"4 to 5 years" => 10,
"5 years or more" => 5,
"Do not know" => 6,
}
end
end

3
app/models/case_log.rb

@ -98,6 +98,9 @@ class CaseLog < ApplicationRecord
enum incfreq: DbEnums.incfreq, _suffix: true
enum benefits: DbEnums.benefits, _suffix: true
enum period: DbEnums.period, _suffix: true
enum layear: DbEnums.latime, _suffix: true
enum lawaitlist: DbEnums.latime, _suffix: true
enum reasonpref: DbEnums.polar2, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze

10
db/migrate/20211103090530_change_field_types.rb

@ -56,6 +56,11 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :brent, "integer USING brent::integer"
t.change :scharge, "integer USING scharge::integer"
t.change :pscharge, "integer USING pscharge::integer"
t.change :supcharg, "integer USING supcharg::integer"
t.change :tcharge, "integer USING tcharge::integer"
t.change :layear, "integer USING layear::integer"
t.change :lawaitlist, "integer USING lawaitlist::integer"
t.change :reasonpref, "integer USING reasonpref::integer"
end
end
@ -116,6 +121,11 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :brent, :string
t.change :scharge, :string
t.change :pscharge, :string
t.change :supcharg, :string
t.change :tcharge, :string
t.change :layear, :string
t.change :lawaitlist, :string
t.change :reasonpref, :string
end
end
end

10
db/schema.rb

@ -94,14 +94,14 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.integer "brent"
t.integer "scharge"
t.integer "pscharge"
t.string "supcharg"
t.string "tcharge"
t.integer "supcharg"
t.integer "tcharge"
t.string "outstanding_amount"
t.string "layear"
t.string "lawaitlist"
t.integer "layear"
t.integer "lawaitlist"
t.string "previous_la"
t.string "property_postcode"
t.string "reasonpref"
t.integer "reasonpref"
t.string "reasonable_preference_reason"
t.integer "cbl"
t.integer "chr"

Loading…
Cancel
Save