class CreateBookings < ActiveRecord::Migration[5.1]
  def change
    create_table :bookings, :id => false do |t|
      t.string :booking_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing

      t.references :dining_facility, foreign_key: true
      t.string :type, :null => false, :default => "Table"
      t.datetime :checkin_at, :null => false
      t.string :checkin_by
      t.datetime :checkout_at
      t.string :checkout_by
      t.datetime :reserved_at
      t.string :reserved_by
      t.string :booking_status, :null => false, :default => "new"
      t.string :sale_id, foreign_key: true, :limit => 16
      t.string :customer_id, foreign_key: true, :limit => 16

      t.timestamps
    end
  end
end
