After successfully inserting data with hardcoded values to verify the relation between the 2 columns, I am now wondering if there is a way to reference the value of id
in reply_id
.
This is how I manually inserted data:
const { data, error } = await supabaseServer.from('replies').insert({
text: 'some text',
id: 'e888f9c5-15b1-4e84-90bc-8bc2128a9338',
reply_id: 'e888f9c5-15b1-4e84-90bc-8bc2128a9338'
})
Below is the Table schema in Supabase along with a picture of the relation for clarity:
public.replies (
id uuid not null,
text text not null,
reply_id uuid null,
constraint replies_pkey primary key (id),
constraint replies_reply_id_fkey foreign key (reply_id) references replies (id) on delete cascade,
)
https://i.sstatic.net/vhrph.png
My attempt to reference id
in reply_id
failed. What should I do differently?
text: replyText,
id: randomUUID(),
reply_id: id
})