foodsoft/db/migrate/20210205090257_introduce_received_state_in_orders.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

11 lines
338 B
Ruby

class IntroduceReceivedStateInOrders < ActiveRecord::Migration[5.2]
def up
Order.where(state: 'finished').each do |order|
order.update_attribute(:state, 'received') if order.order_articles.where.not(units_received: nil).any?
end
end
def down
Order.where(state: 'received').update_all(state: 'finished')
end
end