Sha256: ae8c978d24d01722f0f876c4e6d6d77c5bbc26b525abd198433b1c5244aa4c4e

Contents?: true

Size: 661 Bytes

Versions: 35

Compression:

Stored size: 661 Bytes

Contents

class IncreaseScaleOnPreTaxAmounts < ActiveRecord::Migration
  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

35 entries across 35 versions & 2 rubygems

Version Path
spree_core-3.1.14 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.13 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.12 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
solidus_core-1.1.4 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.11 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.10 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.9 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.8 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.7 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.6 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.5 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.4 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.3 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.2 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.0.10 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.1 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.0 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.0.rc4 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.0.9 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb
spree_core-3.1.0.rc3 db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb