How to fix foreign key error when running migration

前端 未结 2 1817
醉话见心
醉话见心 2021-01-26 12:34

I don\'t know why it\'s still don\'t work and show this:

Illuminate\\Database\\QueryException : SQLSTATE[HY000]: General error: 1005 Can\'t create tabl

2条回答
  •  死守一世寂寞
    2021-01-26 13:27

    You foreign key needs to have the same type as the key it references. Therefor the second table foreign key doba needs to be change to this, becuase you use BigIncrements() in the first table primary key.

    $table->unsignedBigInteger('doba');
    

提交回复
热议问题