title: laravel 8 foreign key
body: <p>I try to migrate my table that have a foreign keys. Every time I migrate my table it produce an error which is saying:</p>
  <blockquote>
  <p>General error: 1215 Cannot add foreign key constraint</p>
  </blockquote>
  <p>Here is my table migration:</p>
  <pre><code>Schema::create('profile_pictures', function (Blueprint $table) {
      $table-&gt;bigIncrements('id');
      $table-&gt;bigInteger('user_id')-&gt;nullable();
      $table-&gt;binary('image')-&gt;nullable();
      $table-&gt;timestamps();
  
      $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users')-&gt;onDelete('cascade');
  });
  </code></pre>
  <p>And here is my model:</p>
  <pre><code>class ProfilePicture extends Model
  {
      protected $fillable = [
          'user_id',
          'image'
      ];
  
      public function user()
      {
          $this-&gt;belongsTo(User::class, 'user_id', 'id');
      }
  }
  </code></pre>
  <p>Here is my user table migration:</p>
  <pre><code>Schema::create('users', function (Blueprint $table) {
      $table-&gt;bigIncrements('id');
      $table-&gt;string('username');
      $table-&gt;string('first_name')-&gt;nullable();
      $table-&gt;string('last_name')-&gt;nullable();
      $table-&gt;string('email')-&gt;unique();
      $table-&gt;string('phone')-&gt;nullable();
      $table-&gt;timestamp('email_verified_at')-&gt;nullable();
      $table-&gt;string('password');
      $table-&gt;rememberToken();
      $table-&gt;timestamps();
  });
  </code></pre>