diff --git a/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb b/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb new file mode 100644 index 0000000000..e019ac3fe5 --- /dev/null +++ b/db/migrate/20130814010857_remove_shipping_methods_using_itemwise_calculator.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index d9eff970c6..dbedb06f59 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 => 20130812233634) do +ActiveRecord::Schema.define(:version => 20130814010857) do create_table "adjustment_metadata", :force => true do |t| t.integer "adjustment_id"