Sha256: fcb44ca1237a2046c344b61a793c9ebd7168b5dd65f538b8f06b378ce00f6238

Contents?: true

Size: 395 Bytes

Versions: 9

Compression:

Stored size: 395 Bytes

Contents

# This migration comes from spree (originally 20140709160534)
class BackfillLineItemPreTaxAmount < ActiveRecord::Migration[4.2]
  def change
    # set pre_tax_amount to discounted_amount - included_tax_total
    execute(<<-SQL)
      UPDATE spree_line_items
      SET pre_tax_amount = ((price * quantity) + promo_total) - included_tax_total
      WHERE pre_tax_amount IS NULL;
    SQL
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_purchase_order-3.7.0 spec/dummy/db/migrate/20191113195860_backfill_line_item_pre_tax_amount.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091801_backfill_line_item_pre_tax_amount.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091801_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516181989_backfill_line_item_pre_tax_amount.spree.rb