RLS doesn't work when managing policies with Drizzle?
This is taking to long to understand and I would be grateful for some help!!!
I have my schema distributed between a number of different files grouped by the table's functions/needs. All these files are in my
, drizzle-kit check passes with flying colors
, a push or a migrate call runs smoothly
and everything is being created in Supabase as expected
. Or so I think?
I am following @rphlmr
's
when running
I have my schema distributed between a number of different files grouped by the table's functions/needs. All these files are in my
src/schemas directory. One of these files is dedicated for policies. Nothing crazy. Something like image 1.userProfiles for example is correctly being imported I am following @rphlmr
createDrizzle flow in his SupaSecureSlack example nearly exactly based on my app's needs. Here's whats done so far: - tables created with
.enableRls() - policy is being added in the policies file similar to the example above.
- new role for
was created and is being used for therls_client
connectionclient - tables are seeded with dummy rows
- using
to create acreateDrizzle
function exactly like the example.createDrizzleSupabaseClient() - drizzle config looks like Image 2
when running
db.rls((tx)=> tx.select().from(userProfiles) as an example, I get zero rows back. Running db.admin.select().from(useProfiles) returns the right rows. So RLS is kinda working, but not really, because I definitely have the right policy. I can see it was created in Supabase. BUT, if I add a new policy directly inside of Supabase UI, exactly similar to the one already exists, then rls works. Can someone make it make sense? :nomore: 
