Laravel migration: “Foreign key constraint is incorrectly formed” (errno 150)

后端 未结 22 896
有刺的猬
有刺的猬 2020-11-30 07:21

When migrating my DB, this error appears. Below is my code followed by the error that I am getting when trying to run the migration.

Code



        
22条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 07:46

    In my case the problem was that one of the referenced tables was InnoDB and the other one was MyISAM.

    MyISAM doesn't have support for foreign key relations.

    So, now both tables are InnoDB. Problem solved.

提交回复
热议问题