Use decimal to store number of billed/received units

This commit is contained in:
Patrick Gansterer 2021-03-07 13:06:54 +01:00
parent 79fdb4dafb
commit 1798aad5e2
2 changed files with 13 additions and 2 deletions

View file

@ -0,0 +1,11 @@
class ChangeOrderArticleResultTypes < ActiveRecord::Migration[4.2]
def self.up
change_column :order_articles, :units_billed, :decimal, precision: 8, scale: 3
change_column :order_articles, :units_received, :decimal, precision: 8, scale: 3
end
def self.down
change_column :order_articles, :units_billed, :integer
change_column :order_articles, :units_received, :integer
end
end

View file

@ -331,8 +331,8 @@ ActiveRecord::Schema.define(version: 2021_02_05_090257) do
t.integer "units_to_order", default: 0, null: false
t.integer "lock_version", default: 0, null: false
t.integer "article_price_id"
t.integer "units_billed"
t.integer "units_received"
t.decimal "units_billed", precision: 8, scale: 3
t.decimal "units_received", precision: 8, scale: 3
t.index ["order_id", "article_id"], name: "index_order_articles_on_order_id_and_article_id", unique: true
t.index ["order_id"], name: "index_order_articles_on_order_id"
end