class CreateOrderReservations < ActiveRecord::Migration[5.1]
  def change
    create_table :order_reservations, :id => false do  |t|
      t.string     :order_reservation_id, :limit => 16, :primary_key => true
    	t.string 	   :order_reservation_type, :null => false
    	t.string 	   :customer_id, :null => false
    	t.string 	   :requested_time, :null => false
      t.string     :callback_url, :null => false
      t.string     :transaction_ref, :null => false
      t.string     :sale_id
    	t.integer :item_count, :null => false, :default => 0
      t.integer :total_customer
    	t.string 	:payment_type
    	t.string 	:payment_status
      t.string  :payment_ref
      t.json    :taxes
      t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
      t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
      t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
      t.decimal :convenience_charge, :precision => 10, :scale => 2, :null => false, :default => 0.00
      t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
    	t.string 	:status, :null => false, :default => "new"
      t.string  :order_remark
      t.string  :remark
      t.timestamps
    end
  end

  def down
  	drop_table :order_reservations
  end
end
