How to reference supabase auth user?
I have supabase authentication login setup, so when user logs into web app, it saves to supabase's authentication table. how do i create a reference from drizzle's schema to the auth UID? i want my project table to reference the logged in user
for example:
I saw something similar in another post with the references, but how do i get auth? not sure if this is the correct way still?
8 Replies
Hello, @readitron! I am not much familiar with Supabase, but I think you can find solution here:
https://discord.com/channels/1043890932593987624/1211924508840173588
hi @solo thanks for the reply so from this image,
this portion:
doesn't this mean that its creating a new table?
But what if supabase already has a table which is what I'm confused. Because I wanted to reference an existing table that supabase already has.
![No description](https://cdn.answeroverflow.com/1214384071120126014/GCguhc-XsAEpRA0.webp)
I think it's ok, because in migration you have
CREATE TABLE IF NOT EXISTS
I wanna add Drizzle to my NextJS using Supabase, do u know if we can also add RLS in drizzle ?
@loup PR is in development
https://github.com/drizzle-team/drizzle-orm/pull/1481
GitHub
Feat: [Pg] support for row level security by Angelelz · Pull Reques...
This PR will close #594.
The changes in this PR will not do anything on their own, as this is mostly a migration/push feature from drizzle-kit.
Upon merging this, the user will be able to define ro...
but Im quite confusing with Drizzle. For example in supabase, for making RLS we can check the auth() connected for checking if he got right to access. But is it a custom function made by Supabase ? Or Drizzle can know which user is connected for making the righ RLS (like with NextAuth) ? Sry if isnt clear. Im searching a way to be able in a futur to move away from Supaabse without a lot of changes
Honestly, I am not familiar with Supabase and NextAuth, so I don't know solution for this, unfortunately 😦
I currently have a Supabase database with lot of function, trigger, and RLS. How did u add Drizzle with schema without overwritting your RLS, etc... I dont wanna loose all my work if Drizzle overwrite my setup