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

后端 未结 18 2513
谎友^
谎友^ 2020-12-05 14:15

I have an orders table and a have a sell_shipping_labels which references orders.id as a foreign. However when I run the Laravel migration I get th

18条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 15:03

    For those which marked answer didn't work:

    Check your tables engine. In my case, I was referencing on a MyISAM table in an InnoDB source table. After changing the reference table engine to InnoDB, it worked!

提交回复
热议问题