feat: Include partitioned tables into the schema cache
Allows embedding, UPSERT, INSERT with Location response, OPTIONS request and OpenAPI support for partitioned tables
This commit is contained in:
@@ -11,8 +11,8 @@ import Test.Hspec.Wai
|
||||
import Test.Hspec.Wai.JSON
|
||||
import Text.Heredoc
|
||||
|
||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion112,
|
||||
pgVersion130)
|
||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion110,
|
||||
pgVersion112, pgVersion130)
|
||||
|
||||
import Protolude hiding (get)
|
||||
import SpecHelper
|
||||
@@ -111,7 +111,7 @@ spec actualPgVersion = do
|
||||
, "Content-Range" <:> "*/*" ]
|
||||
}
|
||||
|
||||
context "requesting headers only representation" $
|
||||
context "requesting headers only representation" $ do
|
||||
it "should not throw and return location header when selecting without PK" $
|
||||
request methodPost "/projects?select=name,client_id" [("Prefer", "return=headers-only")]
|
||||
[json|{"id":11,"name":"New Project","client_id":2}|] `shouldRespondWith` ""
|
||||
@@ -120,6 +120,15 @@ spec actualPgVersion = do
|
||||
, "Content-Range" <:> "*/*" ]
|
||||
}
|
||||
|
||||
when (actualPgVersion >= pgVersion110) $
|
||||
it "should not throw and return location header for partitioned tables when selecting without PK" $
|
||||
request methodPost "/partitioned_a" [("Prefer", "return=headers-only")]
|
||||
[json|{"id":5,"name":"first"}|] `shouldRespondWith` ""
|
||||
{ matchStatus = 201
|
||||
, matchHeaders = [ "Location" <:> "/partitioned_a?id=eq.5&name=eq.first"
|
||||
, "Content-Range" <:> "*/*" ]
|
||||
}
|
||||
|
||||
context "requesting no representation" $
|
||||
it "should not throw and return no location header when selecting without PK" $
|
||||
request methodPost "/projects?select=name,client_id" []
|
||||
|
||||
Reference in New Issue
Block a user