Neon Auth | Migrating an existing architecture
How can I fetch data from the
users_sync table?
- When a new user signs-up, a row / object is created in the users_sync table.
- I have existing data created via Prisma that sits in public.
- When the user signs up, I want to duplicate data from the users_sync table over to Models (e.g. User) in public.
#Next.JS #Prisma3 Replies
vicious-gold•4w ago
Hey!
Sounds like you need a trigger. Instead of duplicating the row though, I'd recommend creating a row that references the user in the auth schema and having a on delete/update cascade to keep things properly in sync.
foreign-sapphireOP•4w ago
Thanks. I could update the User Model / row in the prisma schema (which already exists).
e.g. when the user is created (e.g. on Sign-up), I could create a new row in that object.
What is best practise for accessing the
users_sync Table via prisma?
Prisma is currently only synced to the public Table.
It looks like I need a multi-schema in Prisma.vicious-gold•4w ago
I'm not very familiar with Prisma, but looking at the docs, yes it seems like you need to use their multi-schema