Sha256: 7659f0ec52a6bdcfce0bd21c90c11a70c00bffa212446d6c8e7efbe2da7de43e
Contents?: true
Size: 429 Bytes
Versions: 35
Compression:
Stored size: 429 Bytes
Contents
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
Version data entries
35 entries across 35 versions & 3 rubygems