Sha256: 6abf3a45b8a395cfc5cb3cdbedd64fac6b976896004670b2332c07e2ac15d52b

Contents?: true

Size: 428 Bytes

Versions: 5

Compression:

Stored size: 428 Bytes

Contents

class UpdateNameFieldsOnSpreeCreditCards < ActiveRecord::Migration
  def up
    if ActiveRecord::Base.connection.adapter_name.downcase.include? "mysql"
      execute "UPDATE spree_credit_cards SET name = CONCAT_WS(' ', first_name, last_name)"
    else
      execute "UPDATE spree_credit_cards SET name = first_name || ' ' || last_name"
    end
  end

  def down
    execute "UPDATE spree_credit_cards SET name = NULL"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_core-1.4.2 db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb
solidus_core-1.4.1 db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb
solidus_core-1.4.0 db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb
solidus_core-1.4.0.rc1 db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb
solidus_core-1.4.0.beta1 db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb