How can I read the table name and schema name of a created drizzle table instance?
Given a schema defined like this.
I have this file, where I'm importing the users table schema above. How can I access the string value of the table name and schema name that this users table refers to?
I would expect the above function to work, since typescript autocompletes the
._.name
and ._.schema
values in my editor, but when the code runs, the underscore property is undefined. Is there something excluding this property from the final build? Please let me know if there is a way to accomplish this or if it’s just not possible with the current version.
Thanks!3 Replies
I think you're looking for this helper https://orm.drizzle.team/docs/goodies#get-table-information
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Everything in the
_
is there only for type information. It doesn't have anything at runtimePerfect, thank you!