title: Laravel 8 Migration "General error: 1215 Cannot add foreign key constraint"
body: <p>I'm trying to create a migration on Laravel 8, Here's my table</p>
  <pre><code>class CreateProductVariationOrderTable extends Migration {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('product_variation_order', function (Blueprint $table) {
              $table-&gt;integer('order_id')-&gt;unsigned()-&gt;index();
              $table-&gt;integer('product_variation_id')-&gt;unsigned()-&gt;index();
              $table-&gt;integer('quantity')-&gt;unsigned();
              $table-&gt;timestamps();
  
              $table-&gt;foreign('order_id')-&gt;references('id')-&gt;on('orders')-&gt;onDelete('cascade');
              $table-&gt;foreign('product_variation_id')-&gt;references('id')-&gt;on('product_variations')-&gt;onDelete('cascade');
          });
      }
      public function down()
      {
          Schema::dropIfExists('product_variation_order');
      }
  }
  </code></pre>
  <p>And When I run <code>php artisan migrate</code> I get this chunk of error : <code>SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table </code>product_variation_order<code>add constraint</code>product_variation_order_order_id_foreign<code> foreign key (</code>order_id<code>) references </code>orders<code> (</code>id<code>) on delete cascade)</code></p>
  <p>⚠️ EDIT: Here's my <code>product_variation</code> migration file.</p>
  <pre><code>class CreateProductVariationsTable extends Migration {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('product_variations', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;integer('product_id')-&gt;unsigned()-&gt;index();
              $table-&gt;string('name');
              $table-&gt;integer('price')-&gt;nullable();
              $table-&gt;integer('order')-&gt;nullable();
              $table-&gt;timestamps();
  
              $table-&gt;foreign('product_id')-&gt;references('id')-&gt;on('products');
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::dropIfExists('product_variations');
      }
  }
  </code></pre>