Browse Source

Run migrations

pull/127/head
Kat 4 years ago
parent
commit
06355bff76
  1. 7
      app/constants/db_enums.rb
  2. 1
      app/models/case_log.rb
  3. 22
      config/forms/2021_2022.json
  4. 19
      db/migrate/20211201114814_change_lettype_derived_field.rb
  5. 8
      db/schema.rb
  6. 2
      spec/factories/case_log.rb
  7. 2
      spec/fixtures/complete_case_log.json

7
app/constants/db_enums.rb

@ -733,4 +733,11 @@ module DbEnums
"Intermediate Rent" => 3,
}
end
def self.needstype
{
"General Needs" => 1,
"Supported Housing" => 2,
}
end
end

1
app/models/case_log.rb

@ -110,6 +110,7 @@ class CaseLog < ApplicationRecord
enum builtype: DbEnums.builtype, _suffix: true
enum incref: DbEnums.polar, _suffix: true
enum renttype: DbEnums.renttype, _suffix: true
enum needstype: DbEnums.needstype, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at renttype].freeze
OPTIONAL_FIELDS = %w[do_you_know_the_postcode

22
config/forms/2021_2022.json

@ -133,7 +133,7 @@
"header": "What is intermediate rent product name?",
"type": "text"
},
"needs_type": {
"needstype": {
"check_answer_label": "What is the needs type?",
"header": "What is the needs type?",
"hint_text": "",
@ -1065,26 +1065,6 @@
}
}
},
"letting_type": {
"header": "",
"description": "",
"questions": {
"lettype": {
"check_answer_label": "Type of letting",
"header": "Which type of letting is this?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Social Rent - General Needs",
"1": "Social Rent - Supporting Housing",
"2": "Affordable Rent - General Needs",
"3": "Affordable Rent - Supporting Housing",
"4": "Rent To Buy - General Needs",
"5": "Rent To Buy - Supported Housing"
}
}
}
},
"letting_provider": {
"header": "",
"description": "",

19
db/migrate/20211201114814_change_lettype_derived_field.rb

@ -0,0 +1,19 @@
class ChangeLettypeDerivedField < ActiveRecord::Migration[6.1]
def up
change_table :case_logs, bulk: true do |t|
t.remove :needs_type
t.column :needstype, :integer
t.remove :lettype
t.column :lettype, :integer
end
end
def down
change_table :case_logs, bulk: true do |t|
t.column :needs_type, :string
t.remove :needstype
t.remove :lettype
t.column :lettype, :string
end
end
end

8
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_11_30_144840) do
ActiveRecord::Schema.define(version: 2021_12_01_114814) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -77,7 +77,6 @@ ActiveRecord::Schema.define(version: 2021_11_30_144840) do
t.integer "startertenancy"
t.integer "tenancylength"
t.integer "tenancy"
t.string "lettype"
t.integer "landlord"
t.string "previous_postcode"
t.integer "rsnvac"
@ -137,7 +136,6 @@ ActiveRecord::Schema.define(version: 2021_11_30_144840) do
t.string "tenant_same_property_renewal"
t.string "rent_type"
t.string "intermediate_rent_product_name"
t.string "needs_type"
t.string "purchaser_code"
t.integer "reason"
t.string "propcode"
@ -165,10 +163,12 @@ ActiveRecord::Schema.define(version: 2021_11_30_144840) do
t.string "why_dont_you_know_la"
t.integer "unitletas"
t.integer "builtype"
t.datetime "property_void_date"
t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id"
t.datetime "property_void_date"
t.integer "renttype"
t.integer "needstype"
t.integer "lettype"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"

2
spec/factories/case_log.rb

@ -113,7 +113,7 @@ FactoryBot.define do
tenant_same_property_renewal { 1 }
rent_type { 1 }
intermediate_rent_product_name { 2 }
needs_type { 1 }
needstype { 1 }
purchaser_code { 798_794 }
reason { "Permanently decanted from another property owned by this landlord" }
propcode { "123" }

2
spec/fixtures/complete_case_log.json vendored

@ -128,7 +128,7 @@
"sale_or_letting": "",
"rent_type": "",
"intermediate_rent_product_name": "",
"needs_type": "",
"needstype": "",
"sale_completion_date": "01/01/2020",
"purchaser_code": "",
"propcode": "123",

Loading…
Cancel
Save