title: Heroku Rails - ActiveRecord::UnknownAttributeError (unknown attribute 'user_id' for Timetable.):
body: <p>This problem has me stumped.</p>
  
  <p>When deployed to Heroku i got the error but not locally which would indicate a problem with the db</p>
  
  <p>Line its referring to </p>
  
  <pre><code> class StaticPagesController &lt; ApplicationController
  
    def home
  
      if logged_in?
        @project = current_user.projects.build if logged_in?
        **@timetable = current_user.timetables.build if logged_in?**
        @feed_items = current_user.feed.paginate(page: params[:page]).reorder("project_due_date ASC")
        @feed_items3 = current_user.feed3.paginate(page: params[:page], :per_page =&gt; 1)
      end
    end
  </code></pre>
  
  <p>I've tried</p>
  
  <pre><code>Heroku run db:migrate and Heroku restart 
  </code></pre>
  
  <p>Still same error</p>
  
  <p>It may be the fact that i have the schema wrong somehow but when woud that affect Heroku but not localhost?</p>
  
  <p>URL = <a href="https://radiant-sea-5676.herokuapp.com/" rel="nofollow">https://radiant-sea-5676.herokuapp.com/</a></p>
  
  <p>Edit - It seems to work when not logged in on Heroku but crashes when logged in. Works either way on localhost.</p>
  
  <p>Edit Again - Checking the schema through Heroku shows there is no User iD column and no Index setup for the User iD even after a migrate.</p>
  
  <pre><code>    create_table "timetables", force: :cascade do |t|
      t.string   "name",       limit: 255
      t.string   "attachment", limit: 255
      t.datetime "created_at",             null: false
      t.datetime "updated_at",             null: false
    end
  </code></pre>