uuid is not getting added

const { data, error } = await supabase.from("works").insert([
{
title,
description,
original_image_url: imageUrl,
svg_data: svgData,
},
]);
const { data, error } = await supabase.from("works").insert([
{
title,
description,
original_image_url: imageUrl,
svg_data: svgData,
},
]);
this code is run when a button is clicked and when im logged in but in the table i dont see my uuid
No description
No description
5 Replies
ihm40
ihm403w ago
are you setting a default value for the user_id column, i think auth.id() should work or else you need to pass in the user_id value from the frontend
Shitanshu | Contributor
do i need to add auth.id?
ihm40
ihm403w ago
either that or pass in user_id from the frontend as your original query does not have it
Shitanshu | Contributor
because https://www.youtube.com/watch?v=7uKQBl9uZ00 in this video on at 4:44 the slides say
Traversy Media
YouTube
Supabase Crash Course
In this video we will look at Supabase https://supabase.io Find all of my Udemy courses: https://traversymedia.com 💖 Support The Channel! http://www.patreon.com/traversymedia Timestamps: 0:00 - Intro & Slides 6:24 - Creating a Project 8:10 - Creating a Table & Columns 9:21 - Adding Data 9:38 - API - Read Rows 12:14 - API - Insert Rows 13...
No description
ihm40
ihm403w ago
Ahh i see, the user id's are sent in requests and rls policies can be ran against it but that doesn't mean that it will update columns with the value that happens when you create a new row either by default in the column value or by adding the user_id yourself

Did you find this page helpful?