Merge pull request #1760 from parsonsmatt/matt/support-persistent-2.14

Support persistent-2.14
This commit is contained in:
Michael Snoyman 2022-04-14 05:53:19 +03:00 committed by GitHub
commit b0e461c669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 9 deletions

View File

@ -1,5 +1,9 @@
# ChangeLog for yesod-persistent
## 1.6.0.8
* Add support for `persistent-2.14` [#1706](https://github.com/yesodweb/yesod/pull/1760)
## 1.6.0.7
* Add support for persistent 2.13. [#1723](https://github.com/yesodweb/yesod/pull/1723)

View File

@ -37,6 +37,9 @@ import qualified Database.Persist.Sql as SQL
#if MIN_VERSION_persistent(2,13,0)
import qualified Database.Persist.SqlBackend.Internal as SQL
#endif
#if MIN_VERSION_persistent(2,14,0)
import Database.Persist.Class.PersistEntity
#endif
unSqlPersistT :: a -> a
unSqlPersistT = id
@ -187,14 +190,21 @@ getBy404 key = do
-- is violated.
--
-- @since 1.4.1
#if MIN_VERSION_persistent(2,5,0)
insert400 :: (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend val backend)
=> val
-> ReaderT backend m (Key val)
#if MIN_VERSION_persistent(2,14,0)
insert400
:: (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend val backend, SafeToInsert val)
=> val
-> ReaderT backend m (Key val)
#elif MIN_VERSION_persistent(2,5,0)
insert400
:: (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend val backend)
=> val
-> ReaderT backend m (Key val)
#else
insert400 :: (MonadIO m, PersistUnique (PersistEntityBackend val), PersistEntity val)
=> val
-> ReaderT (PersistEntityBackend val) m (Key val)
insert400
:: (MonadIO m, PersistUnique (PersistEntityBackend val), PersistEntity val)
=> val
-> ReaderT (PersistEntityBackend val) m (Key val)
#endif
insert400 datum = do
conflict <- checkUnique datum
@ -214,7 +224,12 @@ insert400 datum = do
-- | Same as 'insert400', but doesnt return a key.
--
-- @since 1.4.1
#if MIN_VERSION_persistent(2,5,0)
#if MIN_VERSION_persistent(2,14,0)
insert400_ :: (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend val backend, SafeToInsert val)
=> val
-> ReaderT backend m ()
#elif MIN_VERSION_persistent(2,5,0)
insert400_ :: (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend val backend)
=> val
-> ReaderT backend m ()

View File

@ -1,6 +1,6 @@
cabal-version: >= 1.10
name: yesod-persistent
version: 1.6.0.7
version: 1.6.0.8
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>