Needle
05/20/2022, 9:27 PMbenten
05/21/2022, 12:19 AM// create a query and use all the postgres query options
const query = useSupabase().from('site').select('*')
// pass that query to useQuery and get automatic SWR revalidation on it.
const { data: queryData } = useQuery(query)
useSupabase() returns the supabase client.
They use this to construct queries, but doesn't it make an API call as well?Bryan K.
05/21/2022, 2:10 AMempty
or EMPTY
.arcavid
05/21/2022, 4:17 AMsbr
05/21/2022, 4:26 AMwithPageAuth()
set? That is, I'd like a user who logs in to go to the /home
page but /home
has a withPageAuth()
requirement from supabase-auth-helpers
and the redirect doesn't succeedsang.dang
05/21/2022, 6:58 AMdipesh
05/21/2022, 10:35 AMfunction http_post(unknown, unknown, unknown) does not exist
What I did?
- Turn on HTTP extension
- Sample Function
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer
as $$
begin
select
"status", "content"::jsonb
from http_post(
'https://app.doneo.io:5000/notification',
'{"user": new.email,"provider":new.provider}',
'application/json'
);
return new;
end;
$$;
edgaras
05/21/2022, 12:13 PMJingly
05/21/2022, 12:27 PMlanbau
05/21/2022, 12:51 PMlanbau
05/21/2022, 2:23 PMdipesh
05/21/2022, 3:47 PMnew
variable available in postgres trigger function and I can access values like new.email
new.id
. I wanted to also know about value of provider through which register was done and tried with new.provider
, but couldnot retrieve.
Is there any docs available regarding new
variable or is there any way to log new
variable in function to see what is coming. Thanks for the help 🙏dipesh
05/21/2022, 4:50 PMDO $$
DECLARE
email VARCHAR(50) := 'John';
BEGIN
PERFORM
http_post(
'http://app.doneeoo.io/notification',
'{"type":"notify-user","data":{"user": email,"provider":"email"}}',
'application/json'
);
END $$;
Jan Tennert
05/21/2022, 4:51 PMgtims123
05/21/2022, 5:36 PMsang.dang
05/21/2022, 7:18 PMsupabase db remote commit
, I see new file ... ..._remote_commit.sql
in supabase/migrations
folder, but with so weird script:
DROP FUNCTION IF EXISTS graphql.cache_key(role regrole, ast jsonb, variables jsonb);
DROP FUNCTION IF EXISTS graphql.build_delete(ast jsonb, variable_definitions jsonb, variables jsonb, parent_type text, parent_block_name text);
DROP FUNCTION IF EXISTS graphql.build_insert(ast jsonb, variable_definitions jsonb, variables jsonb, parent_type text);
DROP FUNCTION IF EXISTS graphql.build_update(ast jsonb, variable_definitions jsonb, variables jsonb, parent_type text, parent_block_name text);
DROP TABLE IF EXISTS graphql._field CASCADE;
DROP TABLE IF EXISTS graphql._type CASCADE;
....
Is it expected? I didn't change nothing related to graphql
function or extention, why does it want to drop?lumen
05/21/2022, 7:18 PMNeedle
05/21/2022, 7:42 PMhusK
05/22/2022, 3:30 AMuser_id
in the table (with relationship to the auth table) and then have a policy that checks uid() = user_id_column
Is this correct?
ThanksNeedle
05/22/2022, 3:35 AMlanbau
05/22/2022, 4:04 AMedgaras
05/22/2022, 6:48 AMselique
05/22/2022, 9:09 AMlanbau
05/22/2022, 10:21 AMcreate or replace function before_user_added()
returns trigger
language plpgsql
as $$
begin
return case
when (EXISTS(SELECT 1 from settings where user_id = new.user_id and role = 'investor'))
then new
else null
end;
end $$;
create trigger before_auth_user_created
before insert on investors_public
for each row execute procedure before_user_added()
kresimirgalic
05/22/2022, 12:38 PMlanbau
05/22/2022, 1:07 PMconst { data, error } = await supabase.auth.signUp({
email,
password,
});
stnmonroe
05/22/2022, 1:10 PMgoogleapis
and import things from my personal and work calendar. Is there a best practice for this within Supabase?ajbodoc
05/22/2022, 1:11 PMajbodoc
05/22/2022, 1:30 PM