Hey yall, quick question about many to many relations. So I'm in the middle of refactoring an older next.js app and bringing everything up to speed and decided to use prisma on top of our postgres db instead of hand crafting sql statements in next api routes haha.
Anyway, there's a many to many relationship where we didn't normalize the db correctly and implemented the relationship from table1 to table2 via a field in table1 which contained a comma separated list of IDs of table2 rows. We would query this field in db query1, parse it, and loop over the ids querying them individually and returning the resulting mess from the api route 🤦♂️😂
So I got that converted a real Int Array in postgres now, but the
prisma-client is panicking and crashing anytime I findMany in table1 and include table2.
I have setup the relationship in the schema file like any other simple one, except for that the
@relation (fields:..
Part refers to the newly refactored
Int[]
field.
I guess my question is, is this even possible in Prisma? I've looked through the docs many times and only found reference to traditional many-to-many relationships with an intermediate table