Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Farshad's avatar

Migration relation

I create 3 tables with name users,cards and notes and write my relation in note migration and when migrate at first cards table create and after that notes table create and when run the relation because users table not created yet Got error and can't execute my relation.

what can I do for that??????????????

0 likes
1 reply
Stratos's avatar
Stratos
Best Answer
Level 14

Migrations run in the order they are created. You need to rearrange your migration order for it to work. Simply change their creation times until you've got your correct order. So you run Users then Cards then Notes.

Please or to participate in this conversation.