Sign in
Log inSign up
Hoh Shen Yien

3 comments

Gemma Black
Gemma Black
Apr 7, 2023

After using implicit relationships, you'll probably need to go through some troubles (and risky) if you ever need to add custom fields to the intermediary table in the future.

Yeah. That makes a lot of sense. I can see the benefits of having the flexibility built-in upfront rather than having to remodel afterwards.

And thanks for the documentation. I saw some other limitations like no update or delete cascades.

So thanks for explaining that through 馃憣

1
Gemma Black
Gemma Black
Apr 7, 2023

After getting started with prisma recently, this helped fill in some gaps, so thanks for that.

I wonder what the pros and cons are of explicit vs implicit many-to-many schema generations beyond adding custom fields. But thanks for highlighting that.

And Prisma studio is great! I didn't know about it and now I do. Thank you

1 reply
Hoh Shen Yien
Hoh Shen Yien
Author
Apr 7, 2023

That's great to hear!

Personally, I prefer explicit many-to-many (m2m) because you can never be certain about the database schema since requirements are coming and changing all the time.

After using implicit relationships, you'll probably need to go through some troubles (and risky) if you ever need to add custom fields to the intermediary table in the future.

On the other hand, if you're sure that the relationship is straight forward, then yeah implicit m2m will be better because the queries are more concise, refer to this documentation

It is as if the intermediary table doesn't exist at all, so I guess it really depends on your preference and the models you need.

1