Hello guys ! I'm just starting using Supabase and...
# help
e
Hello guys ! I'm just starting using Supabase and I got a use case that I'm not sure how to handle it. I would like to update a row in the DB but without passing all values. I.e : Column Article [Id,Title,Rating], I would like to update the Rating without having to pass the value Title . Kind of a patch method. Is that possible ?
n
Hello @Emixam! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User role so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the /title command! We have solved your problem? Click the button below to archive it.
g
That is update. You specify the columns you want to change, others are not touched. JS call https://supabase.com/docs/reference/javascript/update
n
Emixam (2022-05-03)
g
You can also use the API tab in the dashboard to see bash (URL format) or js format of the calls to any table including update/patch.
e
Hi Gary, Thanks for your prompt response. I think I did that but got a 400, let me do git pull and update once I got the latest code on this device
g
If you are getting an error make sure to get the error detail either from the call or the return in the network tab.
e
This is the payload
and the response : {"message":"null value in column \"salary\" of relation \"profiles\" violates not-null constraint","code":"23502","details":null,"hint":null}
Copy code
const { data, error } = await supabase.from('profiles').upsert({
    overtimecost: settings.overtimecost,
    id: settings.userId,
    salary
  });
Hm I just saw that I'm using upsert. Going to try with update
g
You have a column set to not allow null and you are sending salary as null is one issue. Normally you want a filter also.
e
You're right, I did put it as not null.
I guess I'm a bit tired today, thank you !
2 Views