title: laravel 5.4 migration errno: 150 "Foreign key constraint is incorrectly formed"
body: <p>have 4 migrations as shown below.
  this is users table.</p>
  
  <pre><code> Schema::create('users', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('email')-&gt;unique();
              $table-&gt;string('password');
              $table-&gt;rememberToken();
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>and this is artists migration.</p>
  
  <pre><code>Schema::create('artists', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('slug');
              $table-&gt;string('image')-&gt;nullable();
              $table-&gt;text('biography')-&gt;nullable();
              $table-&gt;integer('week_hits');
              $table-&gt;timestamp('week_date');
              $table-&gt;timestamp('viewed_now');
              $table-&gt;boolean('status')-&gt;default(1);
              $table-&gt;integer('user_id')-&gt;unsigned();
              $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>this is songs migration.</p>
  
  <pre><code>Schema::create('songs', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('title');
              $table-&gt;text('lyrics')-&gt;nullable();
              $table-&gt;string('mp3');
              $table-&gt;string('youtube_id')-&gt;nullable();
              $table-&gt;timestamp('week_date');
              $table-&gt;integer('week_hits')-&gt;nullable();
              $table-&gt;timestamp('played_now')-&gt;nullable();
              $table-&gt;timestamp('hits');
              $table-&gt;integer('album_id')-&gt;unsigned()-&gt;nullable();
              $table-&gt;foreign('album_id')-&gt;references('id')-&gt;on('albums');
              $table-&gt;integer('artist_id')-&gt;unsigned();
              $table-&gt;foreign('artist_id')-&gt;references('id')-&gt;on('artists');
              $table-&gt;timestamps();
          });
      }
  </code></pre>
  
  <p>and this is albums migration.</p>
  
  <pre><code>Schema::create('albums', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('cover');
              $table-&gt;integer('artist_id')-&gt;unsigned();
              $table-&gt;foreign('artist_id')-&gt;references('id')-&gt;on('artists');
              $table-&gt;boolean('status')-&gt;default(true);
              $table-&gt;timestamp('viewed_now')-&gt;nullable();
              $table-&gt;integer('week_hits')-&gt;nullable();
              $table-&gt;timestamp('week_date');
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>and this is featuring which connects many to many , artists and songs.</p>
  
  <pre><code>Schema::create('featuring', function (Blueprint $table) {
      $table-&gt;integer('artist_id')-&gt;unsigned()-&gt;nullable();
      $table-&gt;foreign('artist_id')-&gt;references('id')-&gt;on('artists');
      $table-&gt;integer('song_id')-&gt;unsigned()-&gt;nullable();
      $table-&gt;foreign('song_id')-&gt;references('id')-&gt;on('songs')-&gt;onDelete('cascade');
      $table-&gt;timestamps();
  });
  </code></pre>
  
  <p>when i try to migrate these four migrations i get this error.</p>
  
  <pre><code>SQLSTATE[HY000]: General error: 1005 Can't create table `laravel`.`#sql-f0_11e` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `songs` add const
    raint `songs_album_id_foreign` foreign key (`album_id`) references `albums` (`id`))
  </code></pre>