Skip to content

Why can't two foreign keys refer the same primary key of a table ? #2410

Answered by parseshyam
parseshyam asked this question in Q&A
Discussion options

You must be logged in to vote
model User {
  id             Int             @default(autoincrement()) @id
 ...
 .
 .
 .
 ...
  followRequests FollowRequest[]
************************** missed the following *************************

  user           FollowRequest     @relation("name1")
  follow         FollowRequest     @relation("name2")

**************************************************************************

}

model FollowRequest {
  id        Int               @default(autoincrement()) @id
  createdAt DateTime          @default(now())
  updatedAt DateTime          @default(now())
  status    followingApproval @default(PENDING)
  userId    Int
  followId  Int
  user      User               @relation(name: "name…

Replies: 6 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@janpio
Comment options

@Akxe
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by parseshyam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2410 on May 11, 2020 14:29.