How do I add to the cell that already exists. eg:...
# javascript
c
How do I add to the cell that already exists. eg: I have a row with a col named "website" How do I add another website to this cell....like an array or something. Before: "google(dot)com" After: "google(dot)com, apple(dot)com" Looking at the docs and sending data, update seems to overwrite the current content. Thank you. https://supabase.io/docs/reference/javascript/update
b
Generally, the model is to read in the existing record, then add to it, then write the new version with
update
or
upsert
.
If you're trying to blindly add data to an existing column in the database and you don't have access to what's in it (throwing more data into a column that already has data), then you can do that by writing a simple
PostgreSQL function
that takes the new data as a parameter and updates the database by doing something like
update table set myCol = myCol || ' , ' || newData where x = y;
c
👍🏽
thanks