11. Aug 2022 |

Weird stuff in Laravel

Laravel migrations run in the alphabetical order of their file name

“General error: 1005 Can’t create table [..] Foreign key constraint is incorrectly formed”

This happened when the migration of my in-between table ran before the table its FKs were linked to. First I thought I can not use Laravel’s foreign key constraints but at some point I figured it out. Renaming the migration file helped.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.