Need help in connecting and referencing table in `neon_auth` schema
Recently started using stack auth with neon. The data for users is coming in
users_sync
under neon_auth
schema. I am having a problem while connecting to this schema. My Drizzle config defaults to public
schema and creates a new table named users_sync
.
Here is my table structure in Drizzle,
I have tried to write the table as neon_auth.users_sync
but it doesn't work. Any idea how I can connect and reference users?2 Replies
unwilling-turquoise•2mo ago
Hi @Khushal Sharma, in Drizzle you can switch schemas with the
pgSchema
helper but in this case you can also use the helper function provided by drizzle-orm/neon
. It exports a helper schema for this called usersSync
that you can use.
You can find the implementation here: https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/neon/neon-identity.ts
Note that if you re-export usersSync
drizzle-orm generate
will add the table create instructions to your schema changes. You'll need to comment that out because the table already exists. 🙂GitHub
drizzle-orm/drizzle-orm/src/neon/neon-identity.ts at main · drizzl...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅 - drizzle-team/drizzle-orm
rival-blackOP•2mo ago
Thanks @Andre Landgraf I will take a look 🙂