Sha256: 66ccf0e8b2cb683320472e6c8bf2dbbbb2529bfd8bc365d40b6eeb8495c481fa

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

class AddTaxPolicy < ActiveRecord::Migration
  def up

    #
    # Stores tax rates determined from external system
    #
    unless table_exists? :sales_tax_lines
      create_table :sales_tax_lines do |t|
        t.references :sales_tax_policies
        t.decimal :rate, precision: 8, scale: 2
        t.text :comment
        t.references :taxed_record, polymorphic: true

        t.timestamps
      end
    end

    #
    # Federal Sales Tax
    # State Sales Tax
    # Local Sales Tax
    #
    unless table_exists? :sales_tax_policies
      create_table :sales_tax_policies do |t|
        t.string :description
        t.string :internal_identifier

        t.timestamps
      end
    end

  end

  def down
    [:sales_tax_lines, :sales_tax_policies].each do |table|
      if table_exists? table
        drop_table table
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_orders-4.2.0 db/migrate/20150622151009_add_tax_policy.rb