migrating from supabase

hey folks, im moving RLS policies i had from supabase to pgSQL railway, and in supabase there is auth.uid() which fetches uid from user, what is a substitute for that so it works for pgSQL?
13 Replies
In&Out
In&OutOP3mo ago
@Ping if you know i'd appreciate it, sorry for tag
In&Out
In&OutOP3mo ago
thats not what i asked tho anyone got this? @nikatune do you know by any chance
nikatune
nikatune3mo ago
i dont know sir
In&Out
In&OutOP3mo ago
okay
sebastian
sebastian3mo ago
by pgSQL you mean raw sql query or like using some orm? you can get userid from session
In&Out
In&OutOP3mo ago
raw yes yes but like, i have trigger functions inside postgresql, thats why i need it
WiFi Plug
WiFi Plug3mo ago
Are you sure you need trigger functions now that you use better auth? I was using supabase auth and that forced me to use quite a few triggers to create profiles when users signed up with oauth for example. But with better auth I can have full control of the flow through my server side code interacting with the database. Which I believe is preferred over triggers/functions as you can follow your whole data flow server side
In&Out
In&OutOP3mo ago
i actaully do need it yeah, but i have trigger functions that work without auth.uid i just needed them for RLS, but seems i can do just fine without them, as how its currently going
Arthur
Arthur2mo ago
@In&Out @WiFi Plug Hi guys, are you able to have the supabase client authenticated on the browser to use supabase storage or supabase realtime with better auth ?
In&Out
In&OutOP2mo ago
You can login with supabase client if you mean that And you can send into storage but i recommend you server, not sure what kind of interactivity you need
Arthur
Arthur2mo ago
so you are able to have RLS with better auth ? how do you authenticate the Supabase Client ?

Did you find this page helpful?