I have an HTML form with 3 rows. I have 2 saved records in the table (user didn't fill in all)
The next time the user logs in, he continues to fill out the form, which is pre filled with the previous 2 records from the db. - He edits one row - Fills in the last row, and submits.
How can I: - save the new row, - update the edited one - ignore the unedited row ...without adding duplicates
I tried this:
await supabase.from('notes').insert([ { text: 'This is a test', user_id: '123', form_row: 1, }, { text: 'This is another test', user_id: '123', form_row: 3, }, ], { upsert: true, onConflict: 'id', ignoreDuplicates: false }).select()
await supabase.from('notes').insert([ { text: 'This is a test', user_id: '123', form_row: 1, }, { text: 'This is another test', user_id: '123', form_row: 3, }, ], { upsert: true, onConflict: 'id', ignoreDuplicates: false }).select()
but get this error :
null value in column "id" of relation "notes" violates not-null constraint
null value in column "id" of relation "notes" violates not-null constraint
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.