Support the ongoing development of Laravel.io →
Architecture
Last updated by @backupandforkacc 2 years ago.
0

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.
0

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.

Test

0

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.

0

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?

0

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.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.