title: How to fix 'error : SQLSTATE[HY000]' in migration laravel
body: <p>Im setting up foreign key in a table. When I try run to run it I get an error.</p>
  
  <p>My migration:</p>
  
  <pre class="lang-php prettyprint-override"><code>Schema::create('products', function (Blueprint $table) {
      $table-&gt;bigIncrements('id');
      $table-&gt;string('name');
      $table-&gt;integer('user_id')-&gt;unsigned();
      $table-&gt;integer('camera');
      $table-&gt;integer('weight');
      $table-&gt;integer('price');
      $table-&gt;string('barcode');
      $table-&gt;date('Production_at');
      $table-&gt;timestamps();
  
      $table-&gt;foreign('user_id')
      -&gt;references('id')
      -&gt;on('users')
      -&gt;onDelete('cascade')
      -&gt;onUpdate('cascade');
  });
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1005 Can't create table `phoneshop`.`#sql-1e8_70` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `products` add constraint `products_user_id_foreign` foreign key (`user_id`) references `users` (`id`) on delete cascade on update cascade)
  </code></pre>