mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Remove shipping methods with the now-absent itemwise calculator
This commit is contained in:
@@ -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
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user