title: cannot add foreign key constraint Laravel 5.1
body: <p>I first created all the tables without their foreign keys, I then added the foreign keys for each table, starting with the first table, i got this error:</p>
  
  <pre><code>SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL
    : alter table `accounts` add constraint accounts_client_id_foreign foreign
    key (`client_id`) references `clients` (`id`))
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>public function up()
      {
          Schema::create('accounts', function(Blueprint $table)
          {
          $table-&gt;engine = 'InnoDB';
  
          $table-&gt;bigInteger('id');
  
          $table-&gt;integer('client_id')-&gt;unsigned();
          $table-&gt;foreign('client_id')-&gt;references('id')-&gt;on('clients');
  
          $table-&gt;integer('emp_id')-&gt;unsigned();
          $table-&gt;foreign('emp_id')-&gt;references('id')-&gt;on('employees');
  
          $table-&gt;string('type');
  
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>I tried without $table->engine='innoDB'; but same error</p>
  
  <p>Plus, i tried to separate the foreign keys:</p>
  
  <pre><code>Schema::table('accounts', function($table) {
          $table-&gt;foreign('client_id')-&gt;references('id')-&gt;on('clients');
          $table-&gt;foreign('emp_id')-&gt;references('id')-&gt;on('employees');
      });
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>Base table or view already exists: 1050 Table 'accounts' already exists
  </code></pre>
  
  <p>So when I deleted and re-migrate i get the first error</p>
  
  <p>So whats happening?</p>