Sha256: 06bc8372b725d70b5108183e2dea410bcdabdd386e2d0e499fa15fb471078e7d

Contents?: true

Size: 651 Bytes

Versions: 6

Compression:

Stored size: 651 Bytes

Contents

# This migration comes from spree (originally 20130807024302)
class RenameAdjustmentFields < ActiveRecord::Migration[4.2]
  def up
    remove_column :spree_adjustments, :originator_id
    remove_column :spree_adjustments, :originator_type

    add_column :spree_adjustments, :order_id, :integer unless column_exists?(:spree_adjustments, :order_id)

    # This enables the Spree::Order#all_adjustments association to work correctly
    Spree::Adjustment.reset_column_information
    Spree::Adjustment.where(adjustable_type: "Spree::Order").find_each do |adjustment|
      adjustment.update_column(:order_id, adjustment.adjustable_id)
    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/20180516181923_rename_adjustment_fields.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516181923_rename_adjustment_fields.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516181923_rename_adjustment_fields.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516181923_rename_adjustment_fields.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516181923_rename_adjustment_fields.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516181923_rename_adjustment_fields.spree.rb