Browse Source

Store rent and charges currency as decimal (#247)

pull/243/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
57f0afe648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 39
      db/migrate/20220126101743_change_currency_types.rb
  2. 16
      db/schema.rb

39
db/migrate/20220126101743_change_currency_types.rb

@ -0,0 +1,39 @@
class ChangeCurrencyTypes < ActiveRecord::Migration[7.0]
def up
change_table :case_logs, bulk: true do |t|
t.remove :brent
t.column :brent, :decimal, precision: 10, scale: 2
t.remove :scharge
t.column :scharge, :decimal, precision: 10, scale: 2
t.remove :pscharge
t.column :pscharge, :decimal, precision: 10, scale: 2
t.remove :supcharg
t.column :supcharg, :decimal, precision: 10, scale: 2
t.remove :tcharge
t.column :tcharge, :decimal, precision: 10, scale: 2
t.remove :tshortfall
t.column :tshortfall, :decimal, precision: 10, scale: 2
t.remove :chcharge
t.column :chcharge, :decimal, precision: 10, scale: 2
end
end
def down
change_table :case_logs, bulk: true do |t|
t.remove :brent
t.column :brent, :integer
t.remove :scharge
t.column :scharge, :integer
t.remove :pscharge
t.column :pscharge, :integer
t.remove :supcharg
t.column :supcharg, :integer
t.remove :tcharge
t.column :tcharge, :integer
t.remove :tshortfall
t.column :tshortfall, :integer
t.remove :chcharge
t.column :chcharge, :integer
end
end
end

16
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_01_24_121642) do ActiveRecord::Schema.define(version: 2022_01_26_101743) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -177,14 +177,14 @@ ActiveRecord::Schema.define(version: 2022_01_24_121642) do
t.integer "letting_in_sheltered_accomodation" t.integer "letting_in_sheltered_accomodation"
t.integer "household_charge" t.integer "household_charge"
t.integer "earnings" t.integer "earnings"
t.integer "brent"
t.integer "scharge"
t.integer "pscharge"
t.integer "supcharg"
t.integer "tcharge"
t.integer "tshortfall"
t.integer "chcharge"
t.integer "referral" t.integer "referral"
t.decimal "brent", precision: 10, scale: 2
t.decimal "scharge", precision: 10, scale: 2
t.decimal "pscharge", precision: 10, scale: 2
t.decimal "supcharg", precision: 10, scale: 2
t.decimal "tcharge", precision: 10, scale: 2
t.decimal "tshortfall", precision: 10, scale: 2
t.decimal "chcharge", precision: 10, scale: 2
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" 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 ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id" t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"

Loading…
Cancel
Save