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
|
2023-05-12 13:01:12 +02:00
|
|
|
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
|