Defining disambiguating one-to-one relational query
I'm working with a schema that involves one-to-one disambiguating relationships, and I'm encountering an issue when trying to define these relationships concisely. Here's a simplified version of my schema:
Ideally, I'd like to define the relationships in Transfer by just specifying the relationName, similar to this:
However, this approach results in a type error, suggesting that specifying only the relationName is not sufficient.
The current workaround involves specifying the fields and references explicitly, which makes these fields required:
Similarly, one-to-many has solution for this https://orm.drizzle.team/docs/rqb#disambiguating-relations
My question is: Is there a way to define these one-to-one disambiguating relationships in Drizzle without making the fields required, preferably using just the relationName? If not, are there any plans to support this kind of concise relationship definition in the future?
3 Replies
👋 is it what you are trying to achieve?
(v1) https://drizzle.run/tbhc04badz7ftakv6o8tpk6p
nevermind, simpler version: https://drizzle.run/kj8f8jjoe8wfjeow14of8foi