title: Laravel cannot add foreign key constraint
body: <p>When I'm trying to set a foreign key constraint in laravel 5 with migrations I receive the error:</p>
  
  <blockquote>
    <p>[Illuminate\Database\QueryException]   SQLSTATE[HY000]: General
    error: 1215 
    Cannot add foreign key constraint (SQL: alter table
    <code>rittenregistratie</code> add co   nstraint
    rittenregistratie_karakterrit_id_foreign foreign key
    (<code>karakterrit_id</code>) references <code>karakterrit</code> (<code>id</code>) on    delete
    cascade)   [PDOException]   SQLSTATE[HY000]: General error: 1215
    Cannot add foreign key constraint D:\wamp\www></p>
  </blockquote>
  
  <p>But I have now idea why??? The order of migrating is right so why do I receive this error? The table rittenregistratie has a foreign key called karakterrit_id this is the primary key in the table karakterrit. </p>
  
  <p>This is my migration rittenregistratie:</p>
  
  <pre><code> public function up()
      {
          Schema::create('rittenregistratie', function (Blueprint $table) 
          {
              $table-&gt;increments('id');
              $table-&gt;integer('user_id')-&gt;unsigned();
              $table-&gt;timestamps('datum');
              $table-&gt;integer('beginstand');
              $table-&gt;integer('eindstand');
              $table-&gt;text('van');
              $table-&gt;text('naar');
              $table-&gt;text('bezoekadres');
              $table-&gt;text('geredenroute');
              $table-&gt;integer('karakterrit_id')-&gt;default(1);
              $table-&gt;text('toelichting');
              $table-&gt;integer('kilometerszakelijk');
              $table-&gt;integer('kilomteresprive'); 
  
              $table-&gt;foreign('user_id')
                          -&gt;references('id')
                          -&gt;on('users')
                          -&gt;onDelete('cascade');
  
              $table-&gt;foreign('karakterrit_id')
                          -&gt;references('id')
                          -&gt;on('karakterrit')
                          -&gt;onDelete('cascade');    
          });
      }
  </code></pre>