Upsert with "Prefer: resolution=merge-duplicates" on specified columns (#1327) (#1432)

Allow query param 'on_conflict=key1,key2,...' to upsert with explicit columns with unique
constraint.
This commit is contained in:
YUKISHITA Yohsuke
2019-12-29 11:52:58 -05:00
committed by Steve Chavez
parent e12c1319b6
commit 99b13fa25f
10 changed files with 91 additions and 2 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ app dbStructure proc cols conf apiRequest =
else Nothing
, Just $ contentRangeH 1 0 $
if shouldCount then Just queryTotal else Nothing
, if null pkCols
, if null pkCols && isNothing (iOnConflict apiRequest)
then Nothing
else (\x -> ("Preference-Applied", show x)) <$> iPreferResolution apiRequest
]