DT
Drizzle Team•5mo ago
uri

push don't add supabase policies, and if I use migrate postgresql complains auth.users exists

Hi, I'm stuck with this problem: I'm developing a muli-tennant webapp so I enabled RLS and defined policies so each tennant can only access to his data. However, it seems drizzle-kit push doesn't apply policies to supabase (I can't see any of them in the admin panel) , searching on github seems this is a bug, so I try to generate and migrate but then I face a postgresql error telling me that users table (from auth) already exists. So far I tried: moving the authusers table to another ts file (wrong, drizzle checks the dependency), editing the drizzle.config so schemaFilter: ['public'], doesn't solve the issue. Downgraded to ^0.30.0 and tried to push, same issue.
Is there any way to explicitly exclude tables in the migration process? Any older version that could work? any idea?
I'm completely stuck 😦 thank you
2 Replies
oke
oke•5mo ago
I don't know much about Supabase, but you can manually edit the SQL files Drizzle generated to fit your usage. For example: Adding IF NOT EXISTS to CREATE TABLE statements so that the SQL executor skips table that are already there
uri
uriOP•5mo ago
thank you, that worked, I assumed there would be a way in drizzle without editing the sql file. Sometimes I have had to delete migration files and I didn't want to do manual edits afterwards.

Did you find this page helpful?