class EnsureStoreOnOrders < ActiveRecord::Migration
  class Store < ActiveRecord::Base
    self.table_name = 'spree_stores'
  end
  class Order < ActiveRecord::Base
    self.table_name = 'spree_orders'
  end
  def up
    default_store = Store.find_by(default: true)
    Order.where(store_id: nil).update_all(store_id: default_store.id)
  end
end

Add migration to associate stores with orders.
Add migration to associate stores with orders.

This does the same job as the existing
solidus:migrations:ensure_store_on_orders:up rake task, but is a
migration so that it is easier to run.
