File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ Return ONLY the data JSON:`,
283283 id : 'conflictColumn' ,
284284 title : 'Conflict Column' ,
285285 type : 'short-input' ,
286- placeholder : 'Unique column to match on (defaults to the first unique column )' ,
286+ placeholder : 'Unique column to match on (required if the table has multiple unique columns )' ,
287287 dependsOn : [ 'tableId' ] ,
288288 condition : { field : 'operation' , value : 'upsert_row' } ,
289289 } ,
@@ -646,7 +646,8 @@ Return ONLY the sort JSON:`,
646646 offset : { type : 'number' , description : 'Query result offset' } ,
647647 conflictColumn : {
648648 type : 'string' ,
649- description : 'Unique column to match on for upsert (defaults to the first unique column)' ,
649+ description :
650+ 'Unique column to match on for upsert (required if the table has multiple unique columns)' ,
650651 } ,
651652 } ,
652653
Original file line number Diff line number Diff line change @@ -492,9 +492,12 @@ export async function upsertRow(
492492 )
493493 }
494494 targetColumnKey = getColumnId ( col )
495- } else {
496- // No conflict target specified — default to the first unique column.
495+ } else if ( uniqueColumns . length === 1 ) {
497496 targetColumnKey = getColumnId ( uniqueColumns [ 0 ] )
497+ } else {
498+ throw new Error (
499+ `Table has multiple unique columns (${ uniqueColumns . map ( ( c ) => c . name ) . join ( ', ' ) } ). Specify a conflict column to indicate which one to match on.`
500+ )
498501 }
499502
500503 // Validate row data
You can’t perform that action at this time.
0 commit comments