You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been reading through some of the drizzle code and I can't quite figure out how to introspect relations after they have been created.
My use-case is that my team is trying to build out a factory_bot like implementation using pgTable() and relations() methods as the source of data, but it doesn't seem like relations are accessible after you've defined them.
An example would be that an organization contains many users, and when we go to create an organization, we should be able to introspect it's relations that we've defined them and create any dependent records that the organizations table needs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I've been reading through some of the drizzle code and I can't quite figure out how to introspect relations after they have been created.
My use-case is that my team is trying to build out a factory_bot like implementation using pgTable() and relations() methods as the source of data, but it doesn't seem like relations are accessible after you've defined them.
An example would be that an organization contains many users, and when we go to create an organization, we should be able to introspect it's relations that we've defined them and create any dependent records that the organizations table needs.
We define the relationship like this today
Has anyone tried anything similar? Trying not to duplicate the relationships in the drizzle code and in some custom factory code.
CC: @brettjnorris
Beta Was this translation helpful? Give feedback.
All reactions