mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
13 lines
429 B
Ruby
13 lines
429 B
Ruby
class RemoveShippedState < ActiveRecord::Migration
|
|
def up
|
|
execute "UPDATE orders SET state = 'complete' WHERE state = 'shipped'"
|
|
shipments = select_all "SELECT shipments.id FROM shipments WHERE order_id IN (SELECT orders.id FROM orders WHERE orders.state = 'shipped')"
|
|
shipments.each do |shipment|
|
|
execute "UPDATE shipments SET state='shipped' WHERE id = #{shipment[:id]}"
|
|
end
|
|
end
|
|
|
|
def down
|
|
end
|
|
end
|