Sha256: 66ca2dfce7e5d64652d414e47064b3ab407b8e94eb3c1fdd433041313e725f5d

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

class ChangeNameOfPaymentMethodTypes < ActiveRecord::Migration[5.0]
  def up
    name_maps.each do |old, new|
      Spree::PaymentMethod.where(type: old).update_all(type: new)
    end
  end

  def down
    name_maps.each do |old, new|
      Spree::PaymentMethod.where(type: new).update_all(type: old)
    end
  end

  private
  def name_maps
    {
     'Spree::BillingIntegration::SisowBilling::Ideal' => 'Spree::PaymentMethod::SisowBilling::Ideal',
     'Spree::BillingIntegration::SisowBilling::Bancontact' => 'Spree::PaymentMethod::SisowBilling::Bancontact',
     'Spree::BillingIntegration::SisowBilling::Sofort' => 'Spree::PaymentMethod::SisowBilling::Sofort'
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_billing_sisow-0.9.2 db/migrate/20150417081217_change_name_of_payment_method_types.rb
spree_billing_sisow-0.9.1 db/migrate/20150417081217_change_name_of_payment_method_types.rb