Sha256: 2f008c8007223aa2cb112321d23546ee39445fba348db131039b43400fab5828

Contents?: true

Size: 624 Bytes

Versions: 4

Compression:

Stored size: 624 Bytes

Contents

class TransferSpreeOrdersSignifydScoreData < ActiveRecord::Migration
  disable_ddl_transaction!

  def up
    Spree::Order.connection.execute(<<-SQL)
      insert into spree_signifyd_order_scores (order_id, score, created_at, updated_at)
      select o.id, o.signifyd_score, '#{Time.now.to_s(:db)}', '#{Time.now.to_s(:db)}'
      from spree_orders o
      left join spree_signifyd_order_scores
        on o.id = spree_signifyd_order_scores.order_id
      where o.signifyd_score is not null -- where the order has a score...
      and spree_signifyd_order_scores.id is null -- ...but the new table does not
    SQL
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_signifyd-1.1.0 db/migrate/20150206193231_transfer_spree_orders_signifyd_score_data.rb
solidus_signifyd-1.0.1 db/migrate/20150206193231_transfer_spree_orders_signifyd_score_data.rb
solidus_signifyd-1.0.0 db/migrate/20150206193231_transfer_spree_orders_signifyd_score_data.rb
solidus_signifyd-0.1.1 db/migrate/20150206193231_transfer_spree_orders_signifyd_score_data.rb