Infer typescript type from table with relations
I have a pg table with a one to many relationship. I would like to get the typescript type of this table including the one to many relation.
I've attached images of my schema files. Currently, I have come up with a solution which seems to work but seems a 'bit scuffed' as I can see it being prone to needing ammendment if I change relations in the future.
This is the type I have currently come up with.
Is there some other 'infer......` type that I can use that will achieve what I need?
I've attached images of my schema files. Currently, I have come up with a solution which seems to work but seems a 'bit scuffed' as I can see it being prone to needing ammendment if I change relations in the future.
This is the type I have currently come up with.
Is there some other 'infer......` type that I can use that will achieve what I need?

