Updating many2many relations with RPC call
Hi, from reading here, https://github.com/PostgREST/postgrest/issues/818
I have discovered that I need to create a function that will take the JSON of the object I want to update with all its relations as I can't do it with REST. I'm not quite sure what the function woud look like however to do this. I'm sending JSON in the form
I have a table holding all the top level objects, a table holding the friend and a table called
Using the javascript supabase library I am think I can do
I have discovered that I need to create a function that will take the JSON of the object I want to update with all its relations as I can't do it with REST. I'm not quite sure what the function woud look like however to do this. I'm sending JSON in the form
I have a table holding all the top level objects, a table holding the friend and a table called
friends_connections which holds the many2many relationships, i.e ID -> ID.Using the javascript supabase library I am think I can do
rpc("update_contacts", jsonObj) but I'm not sure what I would put in the function? I think I could do it by literally updating each part one by one and perhaps pass the friends as another argument rather than as a child, but I feel there is an atomic way I should be doing this where PSQL is clever enough to rollback the whole thing if something fails. A link of simple example of updating the customer and the relations to friends using the friends_connections table would be really helpful. Thank you!