packages feed

freckle-app 1.9.0.2 → 1.9.0.3

raw patch · 4 files changed

+20/−11 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Freckle.App.Database: [pccSchema] :: PostgresConnectionConf -> Maybe String
+ Freckle.App.Test: [pccSchema] :: PostgresConnectionConf -> Maybe String
- Freckle.App.Database: PostgresConnectionConf :: String -> Int -> String -> PostgresPassword -> String -> Int -> PostgresStatementTimeout -> PostgresConnectionConf
+ Freckle.App.Database: PostgresConnectionConf :: String -> Int -> String -> PostgresPassword -> String -> Int -> PostgresStatementTimeout -> Maybe String -> PostgresConnectionConf
- Freckle.App.Test: PostgresConnectionConf :: String -> Int -> String -> PostgresPassword -> String -> Int -> PostgresStatementTimeout -> PostgresConnectionConf
+ Freckle.App.Test: PostgresConnectionConf :: String -> Int -> String -> PostgresPassword -> String -> Int -> PostgresStatementTimeout -> Maybe String -> PostgresConnectionConf

Files

CHANGELOG.md view
@@ -1,4 +1,8 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.9.0.2...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.9.0.3...main)++## [v1.9.0.3](https://github.com/freckle/freckle-app/compare/v1.9.0.2...v1.9.0.3)++- Use option `PGSCHEMA` environment variable to set schema at connection start.  ## [v1.9.0.2](https://github.com/freckle/freckle-app/compare/v1.9.0.1...v1.9.0.2) 
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               freckle-app-version:            1.9.0.2+version:            1.9.0.3 license:            MIT license-file:       LICENSE maintainer:         Freckle Education
library/Freckle/App/Database.hs view
@@ -130,6 +130,7 @@   , pccDatabase :: String   , pccPoolSize :: Int   , pccStatementTimeout :: PostgresStatementTimeout+  , pccSchema :: Maybe String   }   deriving stock (Show, Eq) @@ -199,6 +200,7 @@   database <- Env.var Env.nonempty "PGDATABASE" mempty   port <- Env.var Env.auto "PGPORT" mempty   poolSize <- Env.var Env.auto "PGPOOLSIZE" $ Env.def 10+  schema <- optional $ Env.var Env.nonempty "PGSCHEMA" mempty   statementTimeout <-     Env.var (Env.eitherReader readPostgresStatementTimeout) "PGSTATEMENTTIMEOUT"       $ Env.def (PostgresStatementTimeoutSeconds 120)@@ -210,6 +212,7 @@     , pccDatabase = database     , pccPoolSize = poolSize     , pccStatementTimeout = statementTimeout+    , pccSchema = schema     }  data AuroraIamToken = AuroraIamToken@@ -270,20 +273,22 @@   token' <- createAuroraIamToken conf   writeIORef tokenIORef token' -setTimeout :: MonadIO m => PostgresConnectionConf -> Connection -> m ()-setTimeout PostgresConnectionConf {..} conn = do+setStartupOptions :: MonadIO m => PostgresConnectionConf -> Connection -> m ()+setStartupOptions PostgresConnectionConf {..} conn = do   let timeoutMillis = postgresStatementTimeoutMilliseconds pccStatementTimeout-  void $ liftIO $ execute-    conn-    [sql| SET statement_timeout = ? |]-    (Only timeoutMillis)+  liftIO $ do+    void $ execute+      conn+      [sql| SET statement_timeout = ? |]+      (Only timeoutMillis)+    for_ pccSchema $ \schema -> execute conn [sql| SET search_path TO ? |] (Only schema)  makePostgresPoolWith   :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConnectionConf -> m SqlPool makePostgresPoolWith conf@PostgresConnectionConf {..} = case pccPassword of   PostgresPasswordIamAuth -> makePostgresPoolWithIamAuth conf   PostgresPasswordStatic password -> createPostgresqlPoolModified-    (setTimeout conf)+    (setStartupOptions conf)     (postgresConnectionString conf password)     pccPoolSize @@ -298,7 +303,7 @@     token <- readIORef tokenIORef     let connStr = postgresConnectionString conf (unpack $ aitToken token)     conn <- connectPostgreSQL connStr-    setTimeout conf conn+    setStartupOptions conf conn     openSimpleConn logFunc conn  postgresConnectionString :: PostgresConnectionConf -> String -> ByteString
package.yaml view
@@ -1,5 +1,5 @@ name: freckle-app-version: 1.9.0.2+version: 1.9.0.3 maintainer: Freckle Education category: Utils github: freckle/freckle-app