class CreateSales < ActiveRecord::Migration
  def change
    create_table :sales do |t|
      t.belongs_to :customer, index: true
      t.belongs_to :user, index: true
      t.belongs_to :open_cash_register, index: true

      t.string	:sale_type, null: false
      t.decimal :subtotal, precision: 10, scale:2, default: 0.00, null: false
      t.decimal :tax, precision: 10, scale:2, default: 0.00, null: false
      t.decimal :discount, precision: 10, scale:2, default: 0.00, null: false
      t.decimal :total, precision: 10, scale:2, default: 0.00, null: false
      t.integer	:status, null: false, default: 1
      t.date :date_sale, null: false
      t.timestamps null: false
    end
  end
end
