title: Laravel 9 adding foreign key constraint returns 150 error
body: <p>I have created <code>Roles</code> table with <code>Users</code> table, I am trying to add <code>foreign key</code> to <code>users</code> table, but when I migrate, it returns <code>150 error</code>.<br>
  <a href="https://i.stack.imgur.com/CEMak.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CEMak.png" alt="enter image description here" /></a><br>
  I have googled a lot, I got a lot of answers, but no answer worked for me.<br>
  <strong>create_users_table Migration:</strong></p>
  <pre><code>Schema::create('users', function (Blueprint $table) {
      $table-&gt;id();
      $table-&gt;string('name');
      $table-&gt;string('email')-&gt;unique();
      $table-&gt;timestamp('email_verified_at')-&gt;nullable();
      $table-&gt;string('password');
      $table-&gt;foreignId('role_id')
              -&gt;constrained()
              -&gt;onUpdate('cascade')
              -&gt;onDelete('cascade');
      $table-&gt;rememberToken();
      $table-&gt;timestamps();
  });
  </code></pre>
  <p><strong>create_roles_table Migration:</strong></p>
  <pre><code>Schema::create('roles', function (Blueprint $table) {
      $table-&gt;id();
      $table-&gt;string('name');
      $table-&gt;timestamps();
  });
  </code></pre>
  <p>Can someone tell me what's wrong? I am stuck..</p>