Add UPSERT for POST with Prefer:resoultion=merge/ignore-duplicates
This commit is contained in:
committed by
Steve Chávez
parent
102392e4ab
commit
85b1dc0eb4
+6
-3
@@ -6,7 +6,7 @@ import SpecHelper
|
||||
import qualified Hasql.Pool as P
|
||||
|
||||
import PostgREST.App (postgrest)
|
||||
import PostgREST.Config (pgVersion96, configSettings)
|
||||
import PostgREST.Config (pgVersion95, pgVersion96, configSettings)
|
||||
import PostgREST.DbStructure (getDbStructure, getPgVersion, fillSessionWithSettings)
|
||||
import PostgREST.Types (DbStructure(..))
|
||||
import Data.Function (id)
|
||||
@@ -32,6 +32,7 @@ import qualified Feature.AndOrParamsSpec
|
||||
import qualified Feature.RpcSpec
|
||||
import qualified Feature.NonexistentSchemaSpec
|
||||
import qualified Feature.PgVersion96Spec
|
||||
import qualified Feature.UpsertSpec
|
||||
|
||||
import Protolude
|
||||
|
||||
@@ -62,7 +63,9 @@ main = do
|
||||
reset = P.use pool (fillSessionWithSettings (configSettings $ testCfg testDbConn)) >> resetDb testDbConn
|
||||
|
||||
actualPgVersion = pgVersion dbStructure
|
||||
pg96spec | actualPgVersion >= pgVersion96 = [("Feature.PgVersion96Spec" , Feature.PgVersion96Spec.spec)]
|
||||
upsertSpec | actualPgVersion >= pgVersion95 = [("Feature.UpsertSpec", Feature.UpsertSpec.spec)]
|
||||
| otherwise = []
|
||||
pg96spec | actualPgVersion >= pgVersion96 = [("Feature.PgVersion96Spec", Feature.PgVersion96Spec.spec)]
|
||||
| otherwise = []
|
||||
|
||||
specs = uncurry describe <$> [
|
||||
@@ -78,7 +81,7 @@ main = do
|
||||
, ("Feature.StructureSpec" , Feature.StructureSpec.spec)
|
||||
, ("Feature.AndOrParamsSpec" , Feature.AndOrParamsSpec.spec)
|
||||
, ("Feature.NonexistentSchemaSpec" , Feature.NonexistentSchemaSpec.spec)
|
||||
] ++ pg96spec
|
||||
] ++ pg96spec ++ upsertSpec
|
||||
|
||||
hspec $ do
|
||||
mapM_ (beforeAll_ reset . before withApp) specs
|
||||
|
||||
Reference in New Issue
Block a user