Sha256: 1e0bdaece5846e67b47538320af5b878dcef2bbb9630ec85e69119af6dfb653f

Contents?: true

Size: 386 Bytes

Versions: 6

Compression:

Stored size: 386 Bytes

Contents

# This migration comes from spree (originally 20150309161154)
class EnsurePaymentsHaveNumbers < ActiveRecord::Migration[4.2]
  def change
    add_index :spree_payments, :number unless index_exists?(:spree_payments, :number)
    Spree::Payment.where(number: nil).find_each do |payment|
      payment.generate_number
      payment.update_columns(number: payment.number)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516182044_ensure_payments_have_numbers.spree.rb