title: Yii2 migration "Foreign key constraint is incorrectly formed"
body: <p>This is how I have added the foreign key inside of the migration: </p>
  
  <pre><code>$this-&gt;addForeignKey(
          'fk-auth_item_ibfk_1',
          'auth_item',
          'rule_name',
          'auth_rule',
          'name',
          'SET NULL',
          'CASCADE'
      );
  </code></pre>
  
  <p>Exception: </p>
  
  <pre><code>Exception 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table `yii`.`#sql-1ab_85` (errno: 150 "Foreign key constraint is incorrectly formed")
  </code></pre>
  
  <p>Error Info: </p>
  
  <pre><code>Error Info:
  Array
  (
  [0] =&gt; HY000
  [1] =&gt; 1005
  [2] =&gt; Can't create table `yii`.`#sql-1ab_af` (errno: 150 "Foreign key constraint is incorrectly formed")
  )
  </code></pre>
  
  <p>Any help is appreciated. I haven't got a clue why its happening. I have checked that the fields are of same type and size. </p>