could anyone help me with this error? I'm really c...
# orm-help
f
could anyone help me with this error? I'm really confused
n
Hey Fishie 👋 this schema doesn’t work because you’re defining two relation fields on
Channel
but only one back-relation field on
Message
. Every relation in Prisma always needs to be defined on both sides, so you need to add another field to
Message
to match the
latestMessage
field on
Channel
. This page in the docs probably is also relevant: https://www.prisma.io/docs/concepts/components/introspection#disambiguating-relations
f
thanks for the reply! I kinda understand that but i really dont know what i would call the field in the Message model since it will basically always return the same thing as the "channel" field in the Message model hmm.
n
i really dont know what i would call the field in the Message model since it will basically always return the same thing as the “channel” field in the Message model hmm
Fair enough! I think something like
channelForLatestMessage
could be an appropriate name, but I get your point that in this case the field seems somewhat superfluous… If that’s bothering you a lot, you’re more than welcome to create a GitHub issue or drop a comment in this one: https://github.com/prisma/prisma/issues/2018
❤️ 1
f
Thanks a lot! will comment on that issue later. so, something like this in the Message model?
Copy code
channelForLatestMessage Channel? @relation("channelForLatestMessage")