Rasmus Eklund
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Thoo on 4/2/2024 in #questions
Extending next-auth user
I had this exact question on the drizzle discord. This is the answer i got:
"I believe, by default, Drizzle only returns columns included in the table declaration that you pass to a select query. It doesn't do SELECT * FROM table, because it needs to get back the columns in a specific order.
Internally, Auth.js (also known as Next Auth) Drizzle adapter passes its own table declarations to the queries. So even if your table declaration has more columns, the Drizzle adapter doesn't know about them.
If you want additional columns, you'd need to make an additional query to get them in the session callback and return the session with the updated user."
I made an additional db call in the callback to add the data i needed.
6 replies
TTCTheo's Typesafe Cult
•Created by Rasmus Eklund on 3/25/2024 in #questions
T3 drizzle error
Ok, i finally figured out the problem. You cannot have ?schema=public in the db url...
DATABASE_URL="postgresql://postgres:password@localhost:6700/test"
DATABASE_URL="postgresql://postgres:password@localhost:6700/test?schema=public"
4 replies