Fix #1181, correct qualify of function argument type
This commit is contained in:
committed by
Steve Chávez
parent
ab23ed7999
commit
63ead89470
@@ -25,6 +25,7 @@ import Data.Text (split, strip,
|
||||
splitOn)
|
||||
import qualified Data.Text as T
|
||||
import qualified Hasql.Session as H
|
||||
import qualified Hasql.Transaction as HT
|
||||
import PostgREST.Types
|
||||
import Text.InterpolatedString.Perl6 (q, qc)
|
||||
|
||||
@@ -32,14 +33,15 @@ import GHC.Exts (groupWith)
|
||||
import Protolude
|
||||
import Unsafe (unsafeHead)
|
||||
|
||||
getDbStructure :: Schema -> PgVersion -> H.Session DbStructure
|
||||
getDbStructure :: Schema -> PgVersion -> HT.Transaction DbStructure
|
||||
getDbStructure schema pgVer = do
|
||||
tabs <- H.statement () allTables
|
||||
cols <- H.statement schema $ allColumns tabs
|
||||
syns <- H.statement schema $ allSynonyms cols pgVer
|
||||
childRels <- H.statement () $ allChildRelations tabs cols
|
||||
keys <- H.statement () $ allPrimaryKeys tabs
|
||||
procs <- H.statement schema allProcs
|
||||
HT.sql "set local schema ''" -- for getting the fully qualified name(schema.name) of every db object
|
||||
tabs <- HT.statement () allTables
|
||||
cols <- HT.statement schema $ allColumns tabs
|
||||
syns <- HT.statement schema $ allSynonyms cols pgVer
|
||||
childRels <- HT.statement () $ allChildRelations tabs cols
|
||||
keys <- HT.statement () $ allPrimaryKeys tabs
|
||||
procs <- HT.statement schema allProcs
|
||||
|
||||
let rels = addManyToManyRelations . addParentRelations $ addViewChildRelations syns childRels
|
||||
cols' = addForeignKeys rels cols
|
||||
|
||||
@@ -42,7 +42,7 @@ runWithClaims conf eClaims app req =
|
||||
appSettingsSql = pgFmtSetLocal mempty <$> configSettings conf
|
||||
setRoleSql = maybeToList $
|
||||
(\r -> "set local role " <> r <> ";") . toS . pgFmtLit . unquoted <$> M.lookup "role" claimsWithRole
|
||||
setSchemaSql = ["set schema " <> pgFmtLit (configSchema conf) <> ";"] :: [Text]
|
||||
setSchemaSql = ["set local schema " <> pgFmtLit (configSchema conf) <> ";"] :: [Text]
|
||||
-- role claim defaults to anon if not specified in jwt
|
||||
claimsWithRole = M.union claims (M.singleton "role" anon)
|
||||
anon = JSON.String . toS $ configAnonRole conf
|
||||
|
||||
Reference in New Issue
Block a user