Skip to content

Commit

Permalink
Auto-generate onConflict clause from primaryKeys for upserts
Browse files Browse the repository at this point in the history
  • Loading branch information
lauri865 committed Feb 13, 2024
1 parent a16e84d commit 97eeaca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function useUpsertMutation<
query: query ?? undefined,
queriesForTable,
disabled: opts?.disableAutoQuery,
onConflict: primaryKeys.join(','),
...opts,
})(input);
if (data) {
Expand Down
1 change: 1 addition & 0 deletions packages/postgrest-swr/src/mutate/use-upsert-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function useUpsertMutation<
query: query ?? undefined,
queriesForTable,
disabled: opts?.disableAutoQuery,
onConflict: primaryKeys.join(','),
...opts,
},
)(arg);
Expand Down

0 comments on commit 97eeaca

Please sign in to comment.