diff --git a/db/migrate/20170921065259_update_adjustment_states.spree.rb b/db/migrate/20170921065259_update_adjustment_states.spree.rb new file mode 100644 index 0000000000..9040709751 --- /dev/null +++ b/db/migrate/20170921065259_update_adjustment_states.spree.rb @@ -0,0 +1,17 @@ +# This migration comes from spree (originally 20130417120035) +class UpdateAdjustmentStates < ActiveRecord::Migration + def up + Spree::Order.complete.find_each do |order| + order.adjustments.update_all(:state => 'closed') + end + + Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment| + shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment + end + + Spree::Adjustment.where(:state => nil).update_all(:state => 'open') + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 5c70c8e6f9..77459f7d73 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20170512115519) do +ActiveRecord::Schema.define(:version => 20170921065259) do create_table "account_invoices", :force => true do |t| t.integer "user_id", :null => false