Laravel5.5. migrate 提示外键约束错误?

n Connection.php line 664:

SQLSTATE[HY000]: General error: 1005 Can't create table n_fruit.#sql-3fa0_23 (errno: 150 "Foreign key constrain
t is incorrectly formed") (SQL: alter table posts add constraint posts_comment_id_foreign foreign key (comment _id) references comments (id) on delete cascade)

In Connection.php line 458:

SQLSTATE[HY000]: General error: 1005 Can't create table n_fruit.#sql-3fa0_23 (errno: 150 "Foreign key constrain
t is incorrectly formed")

Process finished with exit code 1 at 13:53:34.
Execution time: 12,000 ms.


$table->unsignedInteger('comment_id')->comment('评论id');
            $table->unsignedInteger('category_id')->comment('所属分类id');
            $table->foreign('comment_id')
                  ->references('id')
                  ->on('comments')
                  ->onDelete('cascade');

            $table->foreign('category_id')
                ->references('id')
                ->on('categorys')
                ->onDelete('cascade');

外键约束报错 求大神指导 感谢!

JellyBool
修改的评论也不能少于六个字哦!
hcweb 回复 JellyBool
修改的评论也不能少于六个字哦!
JellyBool 回复 hcweb
修改的评论也不能少于六个字哦!
hcweb 回复 JellyBool
修改的评论也不能少于六个字哦!