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

@@ -3,15 +3,16 @@ class CreateEmployees < ActiveRecord::Migration[5.1]
create_table :employees do |t|
t.string :name, :null => false
t.string :role, :null => false, :default => "cashier"
t.boolean :is_active, :default => true
t.boolean :is_active, :default => true, :index=>true
t.string :emp_id, :null => false
t.string :password_digest, :null => false
t.string :token_session
t.string :token_session, :index=>true
t.datetime :session_expiry
t.datetime :session_last_login
t.string :created_by
t.string :image_path
t.timestamps
end
add_index :employees, [:is_active, :token_session]
end
end