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,10 +3,11 @@ class CreateSaleOrders < ActiveRecord::Migration[5.1]
create_table :sale_orders, :id => false do |t|
t.string :sale_order_id, :limit => 16, :primary_key => true
t.string :sale_id, foreign_key: true,:limit => 16
t.string :order_id, foreign_key: true, :limit => 16
t.string :sale_id, foreign_key: true,:limit => 16, :index => true
t.string :order_id, foreign_key: true, :limit => 16, :index => true
t.timestamps
end
add_index :sale_orders, [:sale_id, :order_id], name: 'index_sale_id_order_id'
end
end