Getting references from a column in types #4387
Unanswered
tharropoulos
asked this question in
Q&A
Replies: 1 comment
-
I've submitted a PR at #4388. Feedback is more than welcome! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Having a schema that looks like this:
and the
Session
table references theUser
table:Getting the referencing tables
I've built a very primitive mapped type to get the names of the tables referencing a table by its name:
But its heavily reliant on the id field's type + the naming scheme always referencing in the format of
<table>Id
(.e.guserId
).This can also be easily spoofed by having a non-referencing column defined while meeting the criteria.
I want to use it on a more generic level:
Is it even possible with the current API or have I not found the correct types?
Beta Was this translation helpful? Give feedback.
All reactions