How to select all from a table and get the the columns names returned as they are stored?
I want to do a
select()
query on my user table to get emailVerified: boolean('email_verified').default(false).notNull(),
What is returning is emailVerified
as opposed to email_verified
.
I want to return the latter, but also all the rest of the columns.
I know I could do this:
But then if I add anything to the user table, I now have to add it to the select statement, where I might forget.
Is there a way to say get ALL columns but return email_verified
as actually email_verified
? Or return all columns with their actual column names, as opposed to the Drizzle version?4 Replies
The column names you get are the ones you defined in your table definition
The keys you defined, in the database the string you passed to the will be the name for that column
yea I understand that. But for this particular instance I needed the original table name
The solution is
getTableColumns()
then