lucasb
07/19/2022, 3:45 AMjs
const { data, error } = await supabase
.from('Comments')
.select(`id, owner:users(id,email)`)
.eq('post_id', params.id);
I keep receiving an error Could not find a relationship between 'Comments' and 'users' in the schema cache I'm not really sure why as it appears I've setup the foreign key correctly. Any suggestions are appreciatedlucasb
07/19/2022, 3:46 AMgaryaustin
07/19/2022, 4:10 AMgaryaustin
07/19/2022, 4:12 AMlucasb
07/19/2022, 12:42 PMlucasb
07/19/2022, 1:06 PMlucasb
07/19/2022, 1:08 PMlucasb
07/19/2022, 1:11 PM-- trigger the function every time a user is created
create trigger on_auth_user_created
after insert on auth.users
for each row
when (old.id is distinct from new.id)
execute procedure public.handle_new_user();garyaustin
07/19/2022, 1:16 PMlucasb
07/19/2022, 1:19 PMgaryaustin
07/19/2022, 1:19 PMcreate function handle_new_user() returns trigger
security definer
language plpgsql
as
$$
begin
insert into public.users (uid, email)
values (new.id, new.email);
return new;
end;
$$;garyaustin
07/19/2022, 1:21 PMlucasb
07/19/2022, 1:21 PMgaryaustin
07/19/2022, 1:22 PMlucasb
07/19/2022, 1:23 PMlucasb
07/19/2022, 1:40 PMgaryaustin
07/19/2022, 1:42 PMlucasb
07/19/2022, 1:46 PMlucasb
07/19/2022, 1:47 PM