title: sql (errno 150 "Foreign key constraint is incorrectly formed")
body: <pre><code>    public function up()
          {
              Schema::create('reviews', function (Blueprint $table) {
                  $table-&gt;id();
                  $table-&gt;integer('product_id')-&gt;unsigned()-&gt;index();
                  $table-&gt;foreign('product_id')-&gt;references('id')-&gt;on('products')-&gt;onDelete('cascade');
              $table-&gt;string('customer');
              $table-&gt;text('review');
              $table-&gt;integer('star');
                  $table-&gt;timestamps();
              });
          }
  
   public function up()
      {
          Schema::create('products', function (Blueprint $table) {
              $table-&gt;id();
              $table-&gt;string('name');
              $table-&gt;text('detail');
              $table-&gt;integer('price');
              $table-&gt;integer('stock');
              $table-&gt;integer('discount');
              $table-&gt;timestamps();
          });
      }
  </code></pre>
  <p>ERROR:</p>
  <blockquote>
  <p>SQLSTATE[HY000]: General error: 1005 Can't create table <code>productsapi</code>.<code>reviews</code> (errno: 150 &quot;Foreign key constraint is incorrectly formed&quot;) (SQL: alter table <code>reviews</code> add constraint <code>reviews_product_id_foreign</code> foreign key (<code>product_id</code>) references <code>products</code> (<code>id</code>) on delete cascade)</p>
  </blockquote>