Joins not working
Hmm, trying to get a simple
The query:
And the result:
Can't get
joinjoin working, obviously doing it wrong. Here are the schemae:create table events (
id uuid primary key DEFAULT gen_random_uuid(),
organizer_id uuid references auth.users not null,
profile_id uuid references profiles.id not null,
name text
);
create table profiles (
id uuid references auth.users not null,
created_at timestamp with time zone default now(),
updated_at timestamp with time zone,
deleted_at timestamp with time zone,
name text,
constraint name_length check (char_length(name) >= 2)
);create table events (
id uuid primary key DEFAULT gen_random_uuid(),
organizer_id uuid references auth.users not null,
profile_id uuid references profiles.id not null,
name text
);
create table profiles (
id uuid references auth.users not null,
created_at timestamp with time zone default now(),
updated_at timestamp with time zone,
deleted_at timestamp with time zone,
name text,
constraint name_length check (char_length(name) >= 2)
);The query:
const { data: event } = await supabaseClient
.from('events')
.select(
`id, name, organizer_id,
profiles(created_at)`
)
.eq('id', event.params.id)
.single();
return {
event,
user: session.user
}; const { data: event } = await supabaseClient
.from('events')
.select(
`id, name, organizer_id,
profiles(created_at)`
)
.eq('id', event.params.id)
.single();
return {
event,
user: session.user
};And the result:
{"id":"41aee507-f7c2-492d-879f-551141dc63e4","name":"Chess","organizer_id":"f316de4e-e478-4ce3-842c-00e98f475870","profiles":null}{"id":"41aee507-f7c2-492d-879f-551141dc63e4","name":"Chess","organizer_id":"f316de4e-e478-4ce3-842c-00e98f475870","profiles":null}Can't get
profilesprofiles to be not null and/or include any data. Thoughts?