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

@@ -2,8 +2,8 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
def change
create_table :shift_sales do |t|
t.references :cashier_terminal, foreign_key: true, :null => false
t.datetime :shift_started_at
t.datetime :shift_closed_at
t.datetime :shift_started_at, :index => true
t.datetime :shift_closed_at, :index => true
t.references :employee, foreign_key: true #cashier
t.decimal :opening_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :closing_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
@@ -26,5 +26,6 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
t.decimal :total_void, :default => 0
t.timestamps
end
add_index :shift_sales, [:shift_started_at, :shift_closed_at]
end
end