title: General error: 1005 Can't create table ,Foreign key constraint is incorrectly formed in laravel
body: <p>why laravel schema reply </p>
  
  <blockquote>
    <p>[Illuminate\Database\QueryException]
      SQLSTATE[HY000]: General error: 1005 Can't create table <code>test</code>.<code>#sql-13cc_d0</code> (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table <code>cities</code> add constrai
      nt <code>cities_provinces_id_foreign</code> foreign key (<code>provinces_id</code>) references <code>provinces</code> (<code>id</code>) on delete cascade)</p>
    
    <p>[PDOException]   SQLSTATE[HY000]: General error: 1005 Can't create
    table <code>test</code>.<code>#sql-13cc_d0</code> (errno: 150 "Foreign key constraint is
    incorrectly formed")</p>
  </blockquote>
  
  <p>first table</p>
  
  <pre><code>Schema::create('provinces', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;boolean('is_enable');
          $table-&gt;boolean('is_deletable');
          $table-&gt;boolean('is_editable');
          $table-&gt;boolean('deleted');
          $table-&gt;timestamps();
      }); 
  </code></pre>
  
  <p>second table</p>
  
  <pre><code>    Schema::create('cities', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;integer('province_id')-&gt;unsigned()-&gt;index();
          $table-&gt;boolean('is_enable');
          $table-&gt;boolean('is_deletable');
          $table-&gt;boolean('is_editable');
          $table-&gt;boolean('deleted');
          $table-&gt;timestamps();
  
  
          $table-&gt;foreign('province_id')
              -&gt;references('id')-&gt;on('provinces')
              -&gt;onDelete('cascade');
  
      });
  </code></pre>