hello again, how to replicate the cartID on the em...
# orm-help
j
hello again, how to replicate the cartID on the empty ones since they are the same entry should I use prisma.$transation (to implement it)or there is any implementation on it? Thank u
r
To replicate it on the empty ones, you can use an update on the product and use
connect
to pass the
cartID
.
Or another way would be to perform an update the
cart
and pass in all the order ids.
j
this is same applies to here product to cart? anyway, the reason I want to replicate it is that I want to make an order history and cart history(or this is impossible? dunno)
r
Yes it will. You can use
connect
to add from any side of the relation.
j
here is my DB schema and some code. I don't know where I make mistake, but when I try to add the product it still returns me an empty []. I am literally confuse,
r
Looks fine to me. Can you add logging to
PrismaClient
like this and see if there is an
update
statement for the connect?:
Copy code
const prisma = new PrismaClient({ log: ['query'] })
j
here is the console.log i don't see any statement for the connect
@Ryan Thank you I already did it, I only change the relation to 1:N to M:N thanks for your help. hehehe
💯 1