add index in migrate file
This commit is contained in:
@@ -2,17 +2,18 @@ class CreateOrders < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :orders, :id => false do |t|
|
||||
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||
t.datetime :date, :null => false
|
||||
t.string :source, :null => false, :default => "emenu"
|
||||
t.datetime :date, :index => true, :null => false
|
||||
t.string :source, :index => true, :null => false, :default => "emenu"
|
||||
t.string :order_type, :null => false, :default => "dine-in"
|
||||
t.string :customer_id, foreign_key: true, :limit => 16
|
||||
t.integer :item_count, :null => false, :default => 0
|
||||
t.integer :quantity_count, :null => false, :default => 0
|
||||
t.string :status, :null => false, :default => "new"
|
||||
t.string :status, :index => true, :null => false, :default => "new"
|
||||
t.json :waiters
|
||||
t.json :guest_info
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :orders, [:date, :source, :status], name: 'index_date_source_status'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user