persistent-postgresql 2.6.3 → 2.8.0
raw patch · 3 files changed
+24/−21 lines, 3 filesdep +unliftio-coredep −monad-controldep ~basedep ~conduitdep ~persistentPVP ok
version bump matches the API change (PVP)
Dependencies added: unliftio-core
Dependencies removed: monad-control
Dependency ranges changed: base, conduit, persistent
API changes (from Hackage documentation)
- Database.Persist.Postgresql: createPostgresqlPool :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -> Int -> m (Pool backend)
+ Database.Persist.Postgresql: createPostgresqlPool :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -> Int -> m (Pool backend)
- Database.Persist.Postgresql: createPostgresqlPoolModified :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool backend)
+ Database.Persist.Postgresql: createPostgresqlPoolModified :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool backend)
- Database.Persist.Postgresql: createPostgresqlPoolModifiedWithVersion :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool backend)
+ Database.Persist.Postgresql: createPostgresqlPoolModifiedWithVersion :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool backend)
- Database.Persist.Postgresql: withPostgresqlConn :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -> (backend -> m a) -> m a
+ Database.Persist.Postgresql: withPostgresqlConn :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -> (backend -> m a) -> m a
- Database.Persist.Postgresql: withPostgresqlConnWithVersion :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> ConnectionString -> (backend -> m a) -> m a
+ Database.Persist.Postgresql: withPostgresqlConnWithVersion :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> ConnectionString -> (backend -> m a) -> m a
- Database.Persist.Postgresql: withPostgresqlPool :: (MonadBaseControl IO m, MonadLogger m, MonadIO m, IsSqlBackend backend) => ConnectionString -> Int -> (Pool backend -> m a) -> m a
+ Database.Persist.Postgresql: withPostgresqlPool :: (MonadLogger m, MonadUnliftIO m, IsSqlBackend backend) => ConnectionString -> Int -> (Pool backend -> m a) -> m a
- Database.Persist.Postgresql: withPostgresqlPoolWithVersion :: (MonadBaseControl IO m, MonadLogger m, MonadIO m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> ConnectionString -> Int -> (Pool backend -> m a) -> m a
+ Database.Persist.Postgresql: withPostgresqlPoolWithVersion :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (Connection -> IO (Maybe Double)) -> ConnectionString -> Int -> (Pool backend -> m a) -> m a
Files
- ChangeLog.md +4/−0
- Database/Persist/Postgresql.hs +15/−16
- persistent-postgresql.cabal +5/−5
ChangeLog.md view
@@ -1,3 +1,7 @@+## 2.8.0++* Switch from `MonadBaseControl` to `MonadUnliftIO`+ ## 2.6.3 * Added new function `migrateEnableExtension`, to enable Postgres extensions in migrations.
Database/Persist/Postgresql.hs view
@@ -45,9 +45,8 @@ import qualified Database.PostgreSQL.LibPQ as LibPQ -import Control.Monad.Trans.Resource import Control.Exception (throw)-import Control.Monad.IO.Class (MonadIO (..))+import Control.Monad.IO.Unlift (MonadIO (..), MonadUnliftIO) import Data.Data import Data.Typeable (Typeable) import Data.IORef@@ -107,7 +106,7 @@ -- finishes using it. Note that you should not use the given -- 'ConnectionPool' outside the action since it may be already -- been released.-withPostgresqlPool :: (MonadBaseControl IO m, MonadLogger m, MonadIO m, IsSqlBackend backend)+withPostgresqlPool :: (MonadLogger m, MonadUnliftIO m, IsSqlBackend backend) => ConnectionString -- ^ Connection string to the database. -> Int@@ -123,7 +122,7 @@ -- the server version (to workaround an Amazon Redshift bug). -- -- @since 2.6.2-withPostgresqlPoolWithVersion :: (MonadBaseControl IO m, MonadLogger m, MonadIO m, IsSqlBackend backend)+withPostgresqlPoolWithVersion :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (PG.Connection -> IO (Maybe Double)) -- ^ action to perform to get the server version -> ConnectionString@@ -141,7 +140,7 @@ -- responsibility to properly close the connection pool when -- unneeded. Use 'withPostgresqlPool' for an automatic resource -- control.-createPostgresqlPool :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend)+createPostgresqlPool :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -- ^ Connection string to the database. -> Int@@ -159,7 +158,7 @@ -- -- @since 2.1.3 createPostgresqlPoolModified- :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend)+ :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (PG.Connection -> IO ()) -- ^ action to perform after connection is created -> ConnectionString -- ^ Connection string to the database. -> Int -- ^ Number of connections to be kept open in the pool.@@ -172,7 +171,7 @@ -- -- @since 2.6.2 createPostgresqlPoolModifiedWithVersion- :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend)+ :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (PG.Connection -> IO (Maybe Double)) -- ^ action to perform to get the server version -> (PG.Connection -> IO ()) -- ^ action to perform after connection is created -> ConnectionString -- ^ Connection string to the database.@@ -183,7 +182,7 @@ -- | Same as 'withPostgresqlPool', but instead of opening a pool -- of connections, only one connection is opened.-withPostgresqlConn :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend)+withPostgresqlConn :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => ConnectionString -> (backend -> m a) -> m a withPostgresqlConn = withPostgresqlConnWithVersion getServerVersion @@ -191,13 +190,13 @@ -- the server version (to workaround an Amazon Redshift bug). -- -- @since 2.6.2-withPostgresqlConnWithVersion :: (MonadIO m, MonadBaseControl IO m, MonadLogger m, IsSqlBackend backend)+withPostgresqlConnWithVersion :: (MonadUnliftIO m, MonadLogger m, IsSqlBackend backend) => (PG.Connection -> IO (Maybe Double))- -> ConnectionString + -> ConnectionString -> (backend -> m a) -> m a withPostgresqlConnWithVersion getVer = withSqlConn . open' (const $ return ()) getVer- + open' :: (IsSqlBackend backend) => (PG.Connection -> IO ())@@ -340,7 +339,7 @@ => PG.Connection -> PG.Query -> [PersistValue]- -> Acquire (Source m [PersistValue])+ -> Acquire (ConduitM () [PersistValue] m ()) withStmt' conn query vals = pull `fmap` mkAcquire openS closeS where@@ -530,7 +529,7 @@ -> IO Bool doesTableExist getter (DBName name) = do stmt <- getter sql- with (stmtQuery stmt vals) ($$ start)+ with (stmtQuery stmt vals) (\src -> runConduit $ src .| start) where sql = "SELECT COUNT(*) FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog'" <> " AND schemaname != 'information_schema' AND tablename=?"@@ -664,7 +663,7 @@ [ PersistText $ unDBName $ entityDB def , PersistText $ unDBName $ fieldDB (entityId def) ]- cs <- with (stmtQuery stmt vals) ($$ helper)+ cs <- with (stmtQuery stmt vals) (\src -> runConduit $ src .| helper) let sqlc = T.concat ["SELECT " ,"c.constraint_name, " ,"c.column_name "@@ -683,7 +682,7 @@ stmt' <- getter sqlc - us <- with (stmtQuery stmt' vals) ($$ helperU)+ us <- with (stmtQuery stmt' vals) (\src -> runConduit $ src .| helperU) return $ cs ++ us where getAll front = do@@ -799,7 +798,7 @@ with (stmtQuery stmt [ PersistText $ unDBName tname , PersistText $ unDBName ref- ]) ($$ do+ ]) (\src -> runConduit $ src .| do Just [PersistInt64 i] <- CL.head return $ if i == 0 then Nothing else Just (DBName "", ref)) d' = case d of
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.6.3+version: 2.8.0 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>@@ -15,19 +15,19 @@ extra-source-files: ChangeLog.md library- build-depends: base >= 4.6 && < 5+ build-depends: base >= 4.8 && < 5 , transformers >= 0.2.1 , postgresql-simple >= 0.4.0 && < 0.6 , postgresql-libpq >= 0.6.1 && < 0.10- , persistent >= 2.6.1 && < 3+ , persistent >= 2.8.0 && < 3 , containers >= 0.2 , bytestring >= 0.9 , text >= 0.7- , monad-control >= 0.2+ , unliftio-core , blaze-builder , time >= 1.1 , aeson >= 0.6.2- , conduit >= 0.5.3+ , conduit >= 1.2.8 , resourcet >= 1.1 , monad-logger >= 0.3.4 , resource-pool