I'm trying to make a model so that a user can own multiple Titles and equip one of them.
The problem is that it does register on the title side, but it does not on the individual user side when I try to query its current title.
The following is how I've built it :
model User {
id String @id @default(cuid())
titles Title[] @relation("titles")
currentTitle Title? @relation("currentTitle", fields: [currentTitleId], references: [id])
currentTitleId String?
}
model Title {
id String @id @default(cuid())
name String?
users User[] @relation("titles")
currentUsers User[] @relation("currentTitle")
}
Is my schema right or did I miss something ? Thanks for your help !