2020-08-07 01:14:14 +02:00
|
|
|
class AddProfitToOrders < ActiveRecord::Migration[4.2]
|
2009-03-17 19:43:41 +01:00
|
|
|
def self.up
|
|
|
|
add_column :orders, :foodcoop_result, :decimal, :precision => 8, :scale => 2
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2009-03-17 19:43:41 +01:00
|
|
|
Order.closed.each do |order|
|
|
|
|
order.update_attribute(:foodcoop_result, order.profit)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :orders, :foodcoop_result
|
|
|
|
end
|
|
|
|
end
|