title: PG::UndefinedTable: ERROR: relation "musicians" does not exist
body: <p><code>rake db:migrate</code> works locally in <code>sqlite3</code> but does not work in <code>postgresql</code> in heroku.</p>
  
  <p><strong>ERROR</strong></p>
  
  <pre><code>PG::UndefinedTable: ERROR:  relation "musicians" does not exist
  : ALTER TABLE "orders" ADD CONSTRAINT "fk_rails_ad134589be"
  FOREIGN KEY ("musician_id")
    REFERENCES "musicians" ("id")
     (0.9ms)  ROLLBACK
  rake aborted!
  StandardError: An error has occurred, this and all later migrations canceled:
  PG::UndefinedTable: ERROR:  relation "musicians" does not exist
  : ALTER TABLE "orders" ADD CONSTRAINT "fk_rails_ad134589be"
  FOREIGN KEY ("musician_id")
  </code></pre>
  
  <p>Here is a link to the entire log: <a href="https://gist.github.com/helloravi/2cb69e0927e63e186b09" rel="nofollow noreferrer">https://gist.github.com/helloravi/2cb69e0927e63e186b09</a></p>
  
  <p>The following is the migration which does not get executed. The error is displayed below the migration code</p>
  
  <pre><code>class CreateAlbums &lt; ActiveRecord::Migration
    def change
      create_table :albums do |t|
        t.string :album_name
        t.references :musician, index: true, foreign_key: true
        t.timestamps null: false
      end
      add_foreign_key :albums, :users, column: :musician_id
    end
  end
  </code></pre>
  
  <p>I have a users table with a musician column which is boolean(some users are musicians)</p>
  
  <p>I even tried using <code>add_foreign_key</code> and still I am not able to figure out what the problem is.</p>
  
  <p>I tried <code>rake db:schema:load</code> and it worked. I want to be able to make <code>rake db:migrate</code> work because I need to be able to migrate in production.</p>