Remove shipping methods with the now-absent itemwise calculator

This commit is contained in:
Rohan Mitchell
2013-08-14 11:27:16 +10:00
parent eaf71e28bb
commit c39bd6b59d
2 changed files with 16 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
class RemoveShippingMethodsUsingItemwiseCalculator < ActiveRecord::Migration
class OpenFoodWeb::Calculator::Itemwise < Spree::Calculator; end
def up
Spree::ShippingMethod.all.select { |sm| sm.calculator.type == 'OpenFoodWeb::Calculator::Itemwise' }.each do |sm|
say "Destroying itemwise shipping method with id #{sm.id}"
sm.destroy
end
end
def down
Spree::ShippingMethod.create!({name: 'Delivery', zone: Spree::Zone.last, calculator: OpenFoodWeb::Calculator::Itemwise.new}, without_protection: true)
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130812233634) do
ActiveRecord::Schema.define(:version => 20130814010857) do
create_table "adjustment_metadata", :force => true do |t|
t.integer "adjustment_id"