Support the ongoing development of →
Last updated by @backupandforkacc 1 year ago.

Not sure I understand your question, but let me try answering anyway: you should create only one migration per table. That way, you'll be able to rollback your changes granularly if needed. That said, if you really want to, you can totally have one migration for multiple databases. It's up to you to decide if it makes sense in the context of your project.

Last updated 1 year ago.

Many thanks for the answer. I think I understood the answer, but found out that the thing is not as easy as I thought first.

I agree to have several migrations, so one migration for recipe, one for tags, one for step etc. But how do I combine them? The JSON I try to create can be found here. The recipe will have several steps. In the linked json, they are numbered, the total number is varying.



Sorry, I'm not sure I understand your new question. Why are you talking about JSON?

Migrations are meant to shape up your database and run all at once when you use ˋphp artisan migrate`. That's how they're combined. I actually wrote a blog post about why and how to use migrations. Maybe it will help you? Let me know.


Sorry for the confusion.

I think my second question is more about api, but as I have explained the case already, I preferred not to start a new topic.

So with the api, how can I combine the migrations/tables as in the link I cited?


That is still another topic and you should create a new thread. You're looking for guidance with Eloquent and relationships. :)

Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.