darian
Explore posts from serversDTDrizzle Team
•Created by darian on 6/24/2024 in #help
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?
4 replies