Advice on backend stack with NextJS
Unanswered
Yacare Caiman posted this in #help-forum
Yacare CaimanOP
I'm trying to make a simple CRUD app, and I'm currently using Supabase Postgres (and auth) with Prisma as my ORM. I'm struggling to find a way to programmatically apply RLS policies. It should be simple in theory but Prisma doesn't natively support so the workaround I've found is to inject raw SQL into migrations - which seems very hacky to me. Furthermore, I can't seem to reference supabase's auth schema from the public schema, e.g. for adding a foreign key to a userId on an object.
I don't have much experience so I want to know am I doing something wrong? I've tried to read the docs and piece together info but haven't really found any 'proper' way to do this. If Supabase + Prisma isn't a good pairing (although I see it everywhere on YouTube) any other recommendations? I heard Drizzle may be an option? Thanks a lot!
I don't have much experience so I want to know am I doing something wrong? I've tried to read the docs and piece together info but haven't really found any 'proper' way to do this. If Supabase + Prisma isn't a good pairing (although I see it everywhere on YouTube) any other recommendations? I heard Drizzle may be an option? Thanks a lot!
3 Replies
Sloth bear
Modifying supabase's auth schema isn't possible, it's a protected schema.
As far as RLS policies go, I personally apply them on the migration where needed or you can run the respective query from the query editor in your dashboard.
As far as RLS policies go, I personally apply them on the migration where needed or you can run the respective query from the query editor in your dashboard.
Yacare CaimanOP
Awesome thanks so much. Is it acceptable to apply the RLS policies through the supabase dashboard? Just seems odd not to do it programmatically?
@Yacare Caiman Awesome thanks so much. Is it acceptable to apply the RLS policies through the supabase dashboard? Just seems odd not to do it programmatically?
Sloth bear
would say it's a preference thing; Doing it via a migration you have a historic paper trail of it and can make it easy to un-do it if needed;
Doing it via the dashboard would assume periodically you export a local
Doing it via the dashboard would assume periodically you export a local
my-cool-app.sql
file every once and awhile that's updated for your app needs;