self-relation
Greetings! Could someone help me? I haven't been able to understand this. I'm checking the followers and following of a user and everything appears correct in my db, but then when I check it the result is reversed. Any idea why? That 1 should appear in following and not in followers.
22 Replies
Do you mean the value in
followingId
and followerId
should be replaced?
Can you please elaborate?Currently there are 2 users, the idea is that user A follows user B
To represent this follow-up, there must be a table containing AId and BId, I named it Follow
As you can see, A or followerId already follows B or followingId
So when I check A and his followers it should return a 0, and his following should return a 1, but it comes out the other way around. And I'm very frustrated because I've already checked every possible error in detail and I don't see anything wrong T.T @Nurul (Prisma)
final result is inverted
I have deleted package.lock, updated dependencies, asked many colleagues, etc. and I have not been able to find the error, I have checked my schema a thousand times, I am dead, I have asked chatGPT. I have read the doc
I really don't want to leave Prisma, I like it a lot. And I don't see any alternatives either. So I don't know what to do.
Can you share your
schema.prisma
file? Also, how are you inserting the record in Follow
table?yes 1s
@Nurul (Prisma)
Let me create a minimal working example with your schema and share it with you