Contacts: error combining many-to-one with one-to-one on the same models
I'm just getting started modeling with Prisma and quickly hit a case I can't find help for in the docs. I want a Person to be able to have any number of Contacts, but exactly one primary Contact. My incorrect model looks like this:
If I remove the
primaryContact
field, this validates fine, but it's giving confusing errors with the primary contact, saying that model Contact lacks a relation back to Person. This is clearly not the case. What's wrong with my approach, and how would you proceed?2 Replies
Did you fix this? I also run into similar problems with unintuitive error messages...
I have not fixed it yet. I did find some links in the Prisma docs to other similar libraries, so I'm trying some other options for now. Might take a second run at Prisma if I find a good modeling tutorial that covers this type of use case 😄