title: Mysql2::Error: Key column 'hotel_user_id' doesn't exist in table
body: <p>I have:</p>
  
  <pre><code>def change
  
    create_table :orders do |t|
      t.string :name
      t.text :address,:limit=&gt;500
      t.string :email
      t.string :pay_type
      t.string :phone,:limit=&gt;25
      t.integer :hotel_user_id
      t.timestamps
    end
  
    add_index("hotel_users","hotel_user_id")
  end
  </code></pre>
  
  <p>Error in log:</p>
  
  <pre><code>$ rake db:migrate
  == 20140822140639 CreateOrders: migrating ====================================
  -- create_table(:orders)
     -&gt; 0.0790s
  
  -- add_index("hotel_users", "hotel_user_id")
  rake aborted!
  
  StandardError: An error has occurred, all later migrations canceled:
  
  
  Mysql2::Error: Key column 'hotel_user_id' doesn't exist in table: CREATE  INDEX index_hotel_users_on_hotel_user_id`  ON 'hot
  el_users' ('hotel_user_id') F:/OrderBooking/db/migrate/20140822140639_create_orders.rb:12:in 'change'
  c:in 'migrate'
  Tasks: TOP =&gt; db:migrate
  (See full trace by running task with --trace)'
  </code></pre>
  
  <p>I have a table <code>hotel_users</code> which has many <code>orders</code>.I orders table i want to set a foreign key.But i am getting the above error while creating the table. </p>