Sha256: 98186bacfa76f054f956eabb6de7c85ddd79c414f476b35e141e7912903e568b

Contents?: true

Size: 728 Bytes

Versions: 9

Compression:

Stored size: 728 Bytes

Contents

# This migration comes from spree (originally 20150609093816)
class IncreaseScaleOnPreTaxAmounts < ActiveRecord::Migration[4.2]
  def change
    # set pre_tax_amount on shipments to discounted_amount - included_tax_total
    # so that the null: false option on the shipment pre_tax_amount doesn't generate
    # errors.
    #
    execute(<<-SQL)
      UPDATE spree_shipments
      SET pre_tax_amount = (cost + promo_total) - included_tax_total
      WHERE pre_tax_amount IS NULL;
    SQL

    change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false
    change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_purchase_order-3.7.0 spec/dummy/db/migrate/20191113195922_increase_scale_on_pre_tax_amounts.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091863_increase_scale_on_pre_tax_amounts.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091863_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.6.0 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.5.0 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.5.0.rc1 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.4.0 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.3.0 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb
spree_purchase_order-3.2.0 spec/dummy/db/migrate/20180516182051_increase_scale_on_pre_tax_amounts.spree.rb