mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Copy and run adjustment states migration from updated version of spree
Note: this migration took 28.7571s to run against Aus production data on my local machine
This commit is contained in:
17
db/migrate/20170921065259_update_adjustment_states.spree.rb
Normal file
17
db/migrate/20170921065259_update_adjustment_states.spree.rb
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user