Larry Mickie
07/30/2022, 5:21 PMmodel Item {
id String @id @default(uuid())
relatedItemsId String[]
relatedItems Item[] @relation("RelatedItems", fields: [relatedItemsId], references: [id])
}
But it throwing and error in my schema file.Raphael Etim
08/02/2022, 8:14 AMmodel Item {
id String @id @default(uuid())
relatedItemsId String[]
relatedItems Item[] @relation("RelatedItems")
Item Item? @relation("RelatedItems", fields: [relatedItemsId], references: [id])
}Larry Mickie
08/02/2022, 9:19 PMRaphael Etim
08/03/2022, 3:22 PMrelatedItems and Item fields will not be present in the database. The Item table will only have id and relatedItemsId columns.
The relation columns only exists at prisma level and not at database level. So the relation Item field is referencing the id column which is the primary key for this table.