Hey guys! I'm having trouble finding documention o...
# prisma-whats-new
a
Hey guys! I'm having trouble finding documention on what exactly it is that
@relation(fieldName: "...")
does. Can anyone point me in the right direction or maybe provide an explanation? I was going through the airbnb clone on git and noticed at some point
sentMessages: [Message!]! @relation(name: "SentMessages")
m
So, this is a custom directive that tells prisma/graphcool that these fields are relational (i.e., one-to-one, one-to-many, etc). You don't need to include the @relation directive as a matter of course--only when the relation is ambiguous (e.g., if you have 'friends: [User]' and 'family: [User]' on the same type).
a
OK! Thanks for that 🙂
m
Does that make sense? There's some documentation on one of the GC/Prisma websites/blogs/repositories somewhere that goes into this. I looked but can't find it (always bookmark useful GC/Prisma related docs). Maybe someone else will chime in with the link.