Sha256: 1143290653624bf2c164bd11282e016b89f600b462345745ed5ebf54cae7f37b

Contents?: true

Size: 390 Bytes

Versions: 6

Compression:

Stored size: 390 Bytes

Contents

# This migration comes from spree (originally 20140709160534)
class BackfillLineItemPreTaxAmount < ActiveRecord::Migration
  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

6 entries across 6 versions & 3 rubygems

Version Path
spree_weight_calculator-0.1.0 test/dummy/db/migrate/20160723192582_backfill_line_item_pre_tax_amount.spree.rb
spree_order_reporting-0.0.3 spec/dummy/db/migrate/20160708163179_backfill_line_item_pre_tax_amount.spree.rb
spree_order_reporting-0.0.2 spec/dummy/db/migrate/20160707103504_backfill_line_item_pre_tax_amount.spree.rb
spree_order_reporting-0.0.1 spec/dummy/db/migrate/20160706112456_backfill_line_item_pre_tax_amount.spree.rb
sprangular-0.1.0 spec/dummy/db/migrate/20141203183761_backfill_line_item_pre_tax_amount.spree.rb
sprangular-0.0.1 spec/dummy/db/migrate/20141203183761_backfill_line_item_pre_tax_amount.spree.rb