persistent 2.7.2 → 2.7.3
raw patch · 7 files changed
+18/−14 lines, 7 filesnew-uploader
Files
- ChangeLog.md +8/−1
- Database/Persist/Class/PersistField.hs +1/−1
- Database/Persist/Sql/Migration.hs +0/−1
- Database/Persist/Sql/Raw.hs +6/−6
- Database/Persist/Sql/Types/Internal.hs +1/−3
- Database/Persist/Types/Base.hs +1/−1
- persistent.cabal +1/−1
ChangeLog.md view
@@ -1,6 +1,13 @@-## 2.7.2+## 2.7.3 +* Reverts [#723](https://github.com/yesodweb/persistent/pull/723), which generalized functions using the `BackendCompatible` class. These changes were an accidental breaking change.+* Recommend the `PersistDbSpecific` docs if someone gets an error about converting from `PersistDbSpecific`++## 2.7.2 [DEPRECATED ON HACKAGE]+ * Many of the functions have been generalized using the `BackendCompatible` class. [#723](https://github.com/yesodweb/persistent/pull/723)+ * This change was an accidental breaking change and was reverted in 2.7.3.+ * These change will be released in a future version of Persistent with a major version bump. * Add raw sql quasi quoters [#717](https://github.com/yesodweb/persistent/pull/717) ## 2.7.1
Database/Persist/Class/PersistField.hs view
@@ -90,7 +90,7 @@ fromPersistValue (PersistBool b) = Right $ Prelude.show b fromPersistValue (PersistList _) = Left $ T.pack "Cannot convert PersistList to String" fromPersistValue (PersistMap _) = Left $ T.pack "Cannot convert PersistMap to String"- fromPersistValue (PersistDbSpecific _) = Left $ T.pack "Cannot convert PersistDbSpecific to String"+ fromPersistValue (PersistDbSpecific _) = Left $ T.pack "Cannot convert PersistDbSpecific to String. See the documentation of PersistDbSpecific for an example of using a custom database type with Persistent." fromPersistValue (PersistObjectId _) = Left $ T.pack "Cannot convert PersistObjectId to String" #endif
Database/Persist/Sql/Migration.hs view
@@ -27,7 +27,6 @@ import Database.Persist.Sql.Types import Database.Persist.Sql.Raw import Database.Persist.Types-import Database.Persist.Sql.Orphan.PersistStore() allSql :: CautiousMigration -> [Sql] allSql = map snd
Database/Persist/Sql/Raw.hs view
@@ -47,20 +47,20 @@ stmtQuery stmt vals -- | Execute a raw SQL statement-rawExecute :: (MonadIO m, BackendCompatible SqlBackend backend)+rawExecute :: MonadIO m => Text -- ^ SQL statement, possibly with placeholders. -> [PersistValue] -- ^ Values to fill the placeholders.- -> ReaderT backend m ()+ -> ReaderT SqlBackend m () rawExecute x y = liftM (const ()) $ rawExecuteCount x y -- | Execute a raw SQL statement and return the number of -- rows it has modified.-rawExecuteCount :: (MonadIO m, BackendCompatible SqlBackend backend)+rawExecuteCount :: (MonadIO m, IsSqlBackend backend) => Text -- ^ SQL statement, possibly with placeholders. -> [PersistValue] -- ^ Values to fill the placeholders. -> ReaderT backend m Int64 rawExecuteCount sql vals = do- conn <- projectBackend `liftM` ask+ conn <- persistBackend `liftM` ask runLoggingT (logDebugNS (pack "SQL") $ T.append sql $ pack $ "; " ++ show vals) (connLogFunc conn) stmt <- getStmt sql@@ -69,10 +69,10 @@ return res getStmt- :: (MonadIO m, BackendCompatible SqlBackend backend)+ :: (MonadIO m, IsSqlBackend backend) => Text -> ReaderT backend m Statement getStmt sql = do- conn <- projectBackend `liftM` ask+ conn <- persistBackend `liftM` ask liftIO $ getStmtConn conn sql getStmtConn :: SqlBackend -> Text -> IO Statement
Database/Persist/Sql/Types/Internal.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -40,7 +39,6 @@ , PersistQueryRead, PersistQueryWrite , PersistStoreRead, PersistStoreWrite , PersistUniqueRead, PersistUniqueWrite- , BackendCompatible(..) ) import Database.Persist.Class.PersistStore (IsPersistBackend (..)) import Database.Persist.Types@@ -132,7 +130,7 @@ -- | A constraint synonym which witnesses that a backend is SQL and can run read queries. type SqlBackendCanRead backend =- ( BackendCompatible SqlBackend backend+ ( IsSqlBackend backend , PersistQueryRead backend, PersistStoreRead backend, PersistUniqueRead backend ) -- | A constraint synonym which witnesses that a backend is SQL and can run read and write queries.
Database/Persist/Types/Base.hs view
@@ -357,7 +357,7 @@ fromPersistValueText (PersistList _) = Left "Cannot convert PersistList to Text" fromPersistValueText (PersistMap _) = Left "Cannot convert PersistMap to Text" fromPersistValueText (PersistObjectId _) = Left "Cannot convert PersistObjectId to Text"-fromPersistValueText (PersistDbSpecific _) = Left "Cannot convert PersistDbSpecific to Text"+fromPersistValueText (PersistDbSpecific _) = Left "Cannot convert PersistDbSpecific to Text. See the documentation of PersistDbSpecific for an example of using a custom database type with Persistent." instance A.ToJSON PersistValue where toJSON (PersistText t) = A.String $ T.cons 's' t
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.7.2+version: 2.7.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>