add index in migrate file

This commit is contained in:
phyusin
2018-07-06 11:55:22 +06:30
parent 6e197fb37e
commit 8e28559fb0
20 changed files with 63 additions and 48 deletions

View File

@@ -5,17 +5,18 @@ class CreateBookings < ActiveRecord::Migration[5.1]
t.references :dining_facility, foreign_key: true
t.string :type, :null => false, :default => "Table"
t.datetime :checkin_at, :null => false
t.datetime :checkin_at, :index => true, :null => false
t.string :checkin_by
t.datetime :checkout_at
t.string :checkout_by
t.string :checkout_by, :index => true
t.datetime :reserved_at
t.string :reserved_by
t.string :booking_status, :null => false, :default => "new"
t.string :reserved_by, :index => true
t.string :booking_status, :index => true, :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
add_index :bookings, [:checkin_at, :checkout_by, :reserved_by, :booking_status], name: 'index_bookings'
end
end