class AddCachesToLineStocks < ActiveRecord::Migration[6.0]
  def change
    add_column :line_stocks, :cc_price_ht_available, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_price_ht_used, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_price_u_ht, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_price_u_kg_ht, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_qte_kg, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_qte_kg_per_unit, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_qte_kg_available, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :cc_qte_kg_used, :decimal,   :precision => 14,   :scale => 2
    
    add_column :line_stocks, :ac_price_ht_available, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_price_ht_used, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_price_u_ht, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_price_u_kg_ht, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_qte_kg, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_qte_kg_per_unit, :decimal,   :precision => 14,   :scale => 2
    
    add_column :line_stocks, :ac_qte_kg_available, :decimal,   :precision => 14,   :scale => 2
    add_column :line_stocks, :ac_qte_kg_used, :decimal,   :precision => 14,   :scale => 2
    
    LineStock.find_each do |ls|
      ls.save
    end
    
  end
end
