Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-persistent-sqlite for 
openSUSE:Factory checked in at 2021-04-10 15:27:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent-sqlite (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-persistent-sqlite.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-persistent-sqlite"

Sat Apr 10 15:27:19 2021 rev:6 rq:883521 version:2.12.0.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-persistent-sqlite/ghc-persistent-sqlite.changes  
    2021-02-16 22:48:39.590566751 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-persistent-sqlite.new.2401/ghc-persistent-sqlite.changes
    2021-04-10 15:28:22.314448655 +0200
@@ -1,0 +2,9 @@
+Wed Mar 31 14:28:25 UTC 2021 - psim...@suse.com
+
+- Update persistent-sqlite to version 2.12.0.0.
+  Upstream has edited the change log file since the last release in
+  a non-trivial way, i.e. they did more than just add a new entry
+  at the top. You can review the file at:
+  
http://hackage.haskell.org/package/persistent-sqlite-2.12.0.0/src/ChangeLog.md
+
+-------------------------------------------------------------------

Old:
----
  persistent-sqlite-2.11.1.0.tar.gz

New:
----
  persistent-sqlite-2.12.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-persistent-sqlite.spec ++++++
--- /var/tmp/diff_new_pack.MnfsaR/_old  2021-04-10 15:28:22.818449248 +0200
+++ /var/tmp/diff_new_pack.MnfsaR/_new  2021-04-10 15:28:22.822449252 +0200
@@ -19,7 +19,7 @@
 %global pkg_name persistent-sqlite
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.11.1.0
+Version:        2.12.0.0
 Release:        0
 Summary:        Backend for the persistent library using sqlite3
 License:        MIT
@@ -52,7 +52,6 @@
 BuildRequires:  ghc-fast-logger-devel
 BuildRequires:  ghc-hspec-devel
 BuildRequires:  ghc-microlens-devel
-BuildRequires:  ghc-persistent-template-devel
 BuildRequires:  ghc-persistent-test-devel
 BuildRequires:  ghc-system-fileio-devel
 BuildRequires:  ghc-system-filepath-devel

++++++ persistent-sqlite-2.11.1.0.tar.gz -> persistent-sqlite-2.12.0.0.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.11.1.0/ChangeLog.md 
new/persistent-sqlite-2.12.0.0/ChangeLog.md
--- old/persistent-sqlite-2.11.1.0/ChangeLog.md 2021-02-05 22:39:24.000000000 
+0100
+++ new/persistent-sqlite-2.12.0.0/ChangeLog.md 2021-03-29 21:25:27.000000000 
+0200
@@ -1,5 +1,9 @@
 # Changelog for persistent-sqlite
 
+## 2.12.0.0
+
+* Decomposed `HaskellName` into `ConstraintNameHS`, `EntityNameHS`, 
`FieldNameHS`. Decomposed `DBName` into `ConstraintNameDB`, `EntityNameDB`, 
`FieldNameDB` respectively. 
[#1174](https://github.com/yesodweb/persistent/pull/1174)
+
 ##  2.11.1.0
 
 * Add `checkForeignKeys` operation to verify no foreign key constraints are
@@ -36,7 +40,6 @@
 * Add `createRawSqlitePoolFromInfo`, `createRawSqlitePoolFromInfo_`,
   `withRawSqlitePoolInfo`, and `withRawSqlitePoolInfo_` to match the existing
   pool functions for regular `SqlBackend`. 
[#983](https://github.com/yesodweb/persistent/pull/983)
->>>>>>> master
 
 ## 2.10.5.2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/persistent-sqlite-2.11.1.0/Database/Persist/Sqlite.hs 
new/persistent-sqlite-2.12.0.0/Database/Persist/Sqlite.hs
--- old/persistent-sqlite-2.11.1.0/Database/Persist/Sqlite.hs   2021-02-05 
22:39:24.000000000 +0100
+++ new/persistent-sqlite-2.12.0.0/Database/Persist/Sqlite.hs   2021-03-29 
21:25:27.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -10,6 +11,12 @@
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE TupleSections #-}
 {-# LANGUAGE TypeFamilies #-}
+-- Strictly, this could go as low as GHC 8.6.1, which is when DerivingVia was
+-- introduced - this base version requires 8.6.5+
+#if MIN_VERSION_base(4,12,0)
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE UndecidableInstances #-}
+#endif
 -- | A sqlite backend for persistent.
 --
 -- Note: If you prepend @WAL=off @ to your connection string, it will disable
@@ -52,10 +59,13 @@
 import qualified Control.Exception as E
 import Control.Monad (forM_)
 import Control.Monad.IO.Unlift (MonadIO (..), MonadUnliftIO, askRunInIO, 
withRunInIO, withUnliftIO, unliftIO, withRunInIO)
-import Control.Monad.Logger (NoLoggingT, runNoLoggingT, MonadLogger, logWarn, 
runLoggingT)
+import Control.Monad.Logger (NoLoggingT, runNoLoggingT, MonadLoggerIO, 
logWarn, runLoggingT, askLoggerIO)
 import Control.Monad.Reader (MonadReader)
 import Control.Monad.Trans.Resource (MonadResource)
-import Control.Monad.Trans.Reader (ReaderT, runReaderT, withReaderT)
+import Control.Monad.Trans.Reader (ReaderT, runReaderT)
+#if !MIN_VERSION_base(4,12,0)
+import Control.Monad.Trans.Reader (withReaderT)
+#endif
 import Control.Monad.Trans.Writer (runWriterT)
 import Data.Acquire (Acquire, mkAcquire, with)
 import Data.Maybe
@@ -67,7 +77,6 @@
 import qualified Data.HashMap.Lazy as HashMap
 import Data.Int (Int64)
 import Data.IORef
-import qualified Data.List as List
 import qualified Data.Map as Map
 import Data.Monoid ((<>))
 import Data.Pool (Pool)
@@ -77,6 +86,9 @@
 import Lens.Micro.TH (makeLenses)
 import UnliftIO.Resource (ResourceT, runResourceT)
 
+#if MIN_VERSION_base(4,12,0)
+import Database.Persist.Compatible
+#endif
 import Database.Persist.Sql
 import qualified Database.Persist.Sql.Util as Util
 import qualified Database.Sqlite as Sqlite
@@ -87,7 +99,7 @@
 -- Note that this should not be used with the @:memory:@ connection string, as
 -- the pool will regularly remove connections, destroying your database.
 -- Instead, use 'withSqliteConn'.
-createSqlitePool :: (MonadLogger m, MonadUnliftIO m)
+createSqlitePool :: (MonadLoggerIO m, MonadUnliftIO m)
                  => Text -> Int -> m (Pool SqlBackend)
 createSqlitePool = createSqlitePoolFromInfo . conStringToInfo
 
@@ -98,14 +110,14 @@
 -- Instead, use 'withSqliteConn'.
 --
 -- @since 2.6.2
-createSqlitePoolFromInfo :: (MonadLogger m, MonadUnliftIO m)
+createSqlitePoolFromInfo :: (MonadLoggerIO m, MonadUnliftIO m)
                          => SqliteConnectionInfo -> Int -> m (Pool SqlBackend)
 createSqlitePoolFromInfo connInfo = createSqlPool $ openWith const connInfo
 
 -- | Run the given action with a connection pool.
 --
 -- Like 'createSqlitePool', this should not be used with @:memory:@.
-withSqlitePool :: (MonadUnliftIO m, MonadLogger m)
+withSqlitePool :: (MonadUnliftIO m, MonadLoggerIO m)
                => Text
                -> Int -- ^ number of connections to open
                -> (Pool SqlBackend -> m a) -> m a
@@ -116,18 +128,18 @@
 -- Like 'createSqlitePool', this should not be used with @:memory:@.
 --
 -- @since 2.6.2
-withSqlitePoolInfo :: (MonadUnliftIO m, MonadLogger m)
+withSqlitePoolInfo :: (MonadUnliftIO m, MonadLoggerIO m)
                    => SqliteConnectionInfo
                    -> Int -- ^ number of connections to open
                    -> (Pool SqlBackend -> m a) -> m a
 withSqlitePoolInfo connInfo = withSqlPool $ openWith const connInfo
 
-withSqliteConn :: (MonadUnliftIO m, MonadLogger m)
+withSqliteConn :: (MonadUnliftIO m, MonadLoggerIO m)
                => Text -> (SqlBackend -> m a) -> m a
 withSqliteConn = withSqliteConnInfo . conStringToInfo
 
 -- | @since 2.6.2
-withSqliteConnInfo :: (MonadUnliftIO m, MonadLogger m)
+withSqliteConnInfo :: (MonadUnliftIO m, MonadLoggerIO m)
                    => SqliteConnectionInfo -> (SqlBackend -> m a) -> m a
 withSqliteConnInfo = withSqlConn . openWith const
 
@@ -190,7 +202,7 @@
 -- | Retry if a Busy is thrown, following an exponential backoff strategy.
 --
 -- @since 2.9.3
-retryOnBusy :: (MonadUnliftIO m, MonadLogger m) => m a -> m a
+retryOnBusy :: (MonadUnliftIO m, MonadLoggerIO m) => m a -> m a
 retryOnBusy action =
   start $ take 20 $ delays 1000
   where
@@ -216,7 +228,7 @@
 --
 -- @since 2.9.3
 waitForDatabase
-    :: (MonadUnliftIO m, MonadLogger m, BackendCompatible SqlBackend backend)
+    :: (MonadUnliftIO m, MonadLoggerIO m, BackendCompatible SqlBackend backend)
     => ReaderT backend m ()
 waitForDatabase = retryOnBusy $ rawExecute "SELECT 42" []
 
@@ -267,7 +279,9 @@
         , connBegin = \f _ -> helper "BEGIN" f
         , connCommit = helper "COMMIT"
         , connRollback = ignoreExceptions . helper "ROLLBACK"
-        , connEscapeName = escape
+        , connEscapeFieldName = escape . unFieldNameDB
+        , connEscapeTableName = escape . unEntityNameDB . entityDB
+        , connEscapeRawName = escape
         , connNoLimit = "LIMIT -1"
         , connRDBMS = "sqlite"
         , connLimitOffset = decorateSQLWithLimitOffset "LIMIT -1"
@@ -327,9 +341,9 @@
           ISRManyKeys sql vals
             where sql = T.concat
                     [ "INSERT INTO "
-                    , escape $ entityDB ent
+                    , escapeE $ entityDB ent
                     , "("
-                    , T.intercalate "," $ map (escape . fieldDB) cols
+                    , T.intercalate "," $ map (escapeF . fieldDB) cols
                     , ") VALUES("
                     , T.intercalate "," (map (const "?") cols)
                     , ")"
@@ -339,19 +353,19 @@
             where
               sel = T.concat
                   [ "SELECT "
-                  , escape $ fieldDB (entityId ent)
+                  , escapeF $ fieldDB (entityId ent)
                   , " FROM "
-                  , escape $ entityDB ent
+                  , escapeE $ entityDB ent
                   , " WHERE _ROWID_=last_insert_rowid()"
                   ]
               ins = T.concat
                   [ "INSERT INTO "
-                  , escape $ entityDB ent
+                  , escapeE $ entityDB ent
                   , if null cols
                         then " VALUES(null)"
                         else T.concat
                           [ "("
-                          , T.intercalate "," $ map (escape . fieldDB) $ cols
+                          , T.intercalate "," $ map (escapeF . fieldDB) $ cols
                           , ") VALUES("
                           , T.intercalate "," (map (const "?") cols)
                           , ")"
@@ -415,7 +429,7 @@
     let (cols, uniqs, fdefs) = sqliteMkColumns allDefs val
     let newSql = mkCreateTable False def (filter (not . safeToRemove val . 
cName) cols, uniqs, fdefs)
     stmt <- getter "SELECT sql FROM sqlite_master WHERE type='table' AND 
name=?"
-    oldSql' <- with (stmtQuery stmt [PersistText $ unDBName table])
+    oldSql' <- with (stmtQuery stmt [PersistText $ unEntityNameDB table])
       (\src -> runConduit $ src .| go)
     case oldSql' of
         Nothing -> return $ Right [(False, newSql)]
@@ -457,7 +471,9 @@
                    , connBegin = \f _ -> helper "BEGIN" f
                    , connCommit = helper "COMMIT"
                    , connRollback = ignoreExceptions . helper "ROLLBACK"
-                   , connEscapeName = escape
+                   , connEscapeFieldName = escape . unFieldNameDB
+                   , connEscapeTableName = escape . unEntityNameDB . entityDB
+                   , connEscapeRawName = escape
                    , connNoLimit = "LIMIT -1"
                    , connRDBMS = "sqlite"
                    , connLimitOffset = decorateSQLWithLimitOffset "LIMIT -1"
@@ -479,10 +495,10 @@
 
 -- | Check if a column name is listed as the "safe to remove" in the entity
 -- list.
-safeToRemove :: EntityDef -> DBName -> Bool
-safeToRemove def (DBName colName)
+safeToRemove :: EntityDef -> FieldNameDB -> Bool
+safeToRemove def (FieldNameDB colName)
     = any (elem FieldAttrSafeToRemove . fieldAttrs)
-    $ filter ((== DBName colName) . fieldDB)
+    $ filter ((== FieldNameDB colName) . fieldDB)
     $ entityFields def
 
 getCopyTable :: [EntityDef]
@@ -490,9 +506,9 @@
              -> EntityDef
              -> IO [(Bool, Text)]
 getCopyTable allDefs getter def = do
-    stmt <- getter $ T.concat [ "PRAGMA table_info(", escape table, ")" ]
+    stmt <- getter $ T.concat [ "PRAGMA table_info(", escapeE table, ")" ]
     oldCols' <- with (stmtQuery stmt []) (\src -> runConduit $ src .| getCols)
-    let oldCols = map DBName oldCols'
+    let oldCols = map FieldNameDB oldCols'
     let newCols = filter (not . safeToRemove def) $ map cName cols
     let common = filter (`elem` oldCols) newCols
     return [ (False, tmpSql)
@@ -512,30 +528,30 @@
                 return $ name : names
             Just y -> error $ "Invalid result from PRAGMA table_info: " ++ 
show y
     table = entityDB def
-    tableTmp = DBName $ unDBName table <> "_backup"
+    tableTmp = EntityNameDB $ unEntityNameDB table <> "_backup"
     (cols, uniqs, fdef) = sqliteMkColumns allDefs def
     cols' = filter (not . safeToRemove def . cName) cols
     newSql = mkCreateTable False def (cols', uniqs, fdef)
     tmpSql = mkCreateTable True def { entityDB = tableTmp } (cols', uniqs, [])
-    dropTmp = "DROP TABLE " <> escape tableTmp
-    dropOld = "DROP TABLE " <> escape table
+    dropTmp = "DROP TABLE " <> escapeE tableTmp
+    dropOld = "DROP TABLE " <> escapeE table
     copyToTemp common = T.concat
         [ "INSERT INTO "
-        , escape tableTmp
+        , escapeE tableTmp
         , "("
-        , T.intercalate "," $ map escape common
+        , T.intercalate "," $ map escapeF common
         , ") SELECT "
-        , T.intercalate "," $ map escape common
+        , T.intercalate "," $ map escapeF common
         , " FROM "
-        , escape table
+        , escapeE table
         ]
     copyToFinal newCols = T.concat
         [ "INSERT INTO "
-        , escape table
+        , escapeE table
         , " SELECT "
-        , T.intercalate "," $ map escape newCols
+        , T.intercalate "," $ map escapeF newCols
         , " FROM "
-        , escape tableTmp
+        , escapeE tableTmp
         ]
 
 mkCreateTable :: Bool -> EntityDef -> ([Column], [UniqueDef], [ForeignDef]) -> 
Text
@@ -546,7 +562,7 @@
         [ "CREATE"
         , if isTemp then " TEMP" else ""
         , " TABLE "
-        , escape $ entityDB entity
+        , escapeE $ entityDB entity
         , "("
         ]
 
@@ -561,12 +577,12 @@
             [ T.drop 1 $ T.concat $ map (sqlColumn isTemp) cols
             , ", PRIMARY KEY "
             , "("
-            , T.intercalate "," $ map (escape . fieldDB) $ compositeFields pdef
+            , T.intercalate "," $ map (escapeF . fieldDB) $ compositeFields 
pdef
             , ")"
             ]
 
         Nothing ->
-            [ escape $ fieldDB (entityId entity)
+            [ escapeF $ fieldDB (entityId entity)
             , " "
             , showSqlType $ fieldSqlType $ entityId entity
             , " PRIMARY KEY"
@@ -589,7 +605,7 @@
 sqlColumn :: Bool -> Column -> Text
 sqlColumn noRef (Column name isNull typ def gen _cn _maxLen ref) = T.concat
     [ ","
-    , escape name
+    , escapeF name
     , " "
     , showSqlType typ
     , if isNull then " NULL" else " NOT NULL"
@@ -598,7 +614,7 @@
     , case ref of
         Nothing -> ""
         Just ColumnReference {crTableName=table, crFieldCascade=cascadeOpts} ->
-          if noRef then "" else " REFERENCES " <> escape table
+          if noRef then "" else " REFERENCES " <> escapeE table
             <> onDelete cascadeOpts <> onUpdate cascadeOpts
     ]
   where
@@ -608,13 +624,13 @@
 sqlForeign :: ForeignDef -> Text
 sqlForeign fdef = T.concat $
     [ ", CONSTRAINT "
-    , escape $ foreignConstraintNameDBName fdef
+    , escapeC $ foreignConstraintNameDBName fdef
     , " FOREIGN KEY("
-    , T.intercalate "," $ map (escape . snd. fst) $ foreignFields fdef
+    , T.intercalate "," $ map (escapeF . snd. fst) $ foreignFields fdef
     , ") REFERENCES "
-    , escape $ foreignRefTableDBName fdef
+    , escapeE $ foreignRefTableDBName fdef
     , "("
-    , T.intercalate "," $ map (escape . snd . snd) $ foreignFields fdef
+    , T.intercalate "," $ map (escapeF . snd . snd) $ foreignFields fdef
     , ")"
     ] ++ onDelete ++ onUpdate
   where
@@ -634,14 +650,23 @@
 sqlUnique :: UniqueDef -> Text
 sqlUnique (UniqueDef _ cname cols _) = T.concat
     [ ",CONSTRAINT "
-    , escape cname
+    , escapeC cname
     , " UNIQUE ("
-    , T.intercalate "," $ map (escape . snd) cols
+    , T.intercalate "," $ map (escapeF . snd) cols
     , ")"
     ]
 
-escape :: DBName -> Text
-escape (DBName s) =
+escapeC :: ConstraintNameDB -> Text
+escapeC = escapeWith escape
+
+escapeE :: EntityNameDB -> Text
+escapeE = escapeWith escape
+
+escapeF :: FieldNameDB -> Text
+escapeF = escapeWith escape
+
+escape :: Text -> Text
+escape s =
     T.concat [q, T.concatMap go s, q]
   where
     q = T.singleton '"'
@@ -652,21 +677,21 @@
 putManySql ent n = putManySql' conflictColumns fields ent n
   where
     fields = entityFields ent
-    conflictColumns = concatMap (map (escape . snd) . uniqueFields) 
(entityUniques ent)
+    conflictColumns = concatMap (map (escapeF . snd) . uniqueFields) 
(entityUniques ent)
 
 repsertManySql :: EntityDef -> Int -> Text
 repsertManySql ent n = putManySql' conflictColumns fields ent n
   where
     fields = keyAndEntityFields ent
-    conflictColumns = escape . fieldDB <$> entityKeyFields ent
+    conflictColumns = escapeF . fieldDB <$> entityKeyFields ent
 
 putManySql' :: [Text] -> [FieldDef] -> EntityDef -> Int -> Text
 putManySql' conflictColumns fields ent n = q
   where
-    fieldDbToText = escape . fieldDB
+    fieldDbToText = escapeF . fieldDB
     mkAssignment f = T.concat [f, "=EXCLUDED.", f]
 
-    table = escape . entityDB $ ent
+    table = escapeE . entityDB $ ent
     columns = Util.commaSeparated $ map fieldDbToText fields
     placeholders = map (const "?") fields
     updates = map (mkAssignment . fieldDbToText) fields
@@ -787,12 +812,13 @@
         _ -> liftIO . E.throwIO . PersistMarshalError $ mconcat
             [ "Unexpected result from foreign key check:\n", T.pack (show l) ]
 
-    query = "\
-\ SELECT origin.rowid, origin.\"table\", group_concat(foreignkeys.\"from\")\n\
-\ FROM pragma_foreign_key_check() AS origin\n\
-\ INNER JOIN pragma_foreign_key_list(origin.\"table\") AS foreignkeys\n\
-\ ON origin.fkid = foreignkeys.id AND origin.parent = foreignkeys.\"table\"\n\
-\ GROUP BY origin.rowid"
+    query = T.unlines
+        [ "SELECT origin.rowid, origin.\"table\", 
group_concat(foreignkeys.\"from\")"
+        , "FROM pragma_foreign_key_check() AS origin"
+        , "INNER JOIN pragma_foreign_key_list(origin.\"table\") AS foreignkeys"
+        , "ON origin.fkid = foreignkeys.id AND origin.parent = 
foreignkeys.\"table\""
+        , "GROUP BY origin.rowid"
+        ]
 
 -- | Like `withSqliteConnInfo`, but exposes the internal `Sqlite.Connection`.
 -- For power users who want to manually interact with SQLite's C API via
@@ -800,12 +826,12 @@
 --
 -- @since 2.10.2
 withRawSqliteConnInfo
-    :: (MonadUnliftIO m, MonadLogger m)
+    :: (MonadUnliftIO m, MonadLoggerIO m)
     => SqliteConnectionInfo
     -> (RawSqlite SqlBackend -> m a)
     -> m a
 withRawSqliteConnInfo connInfo f = do
-    logFunc <- askLogFunc
+    logFunc <- askLoggerIO
     withRunInIO $ \run -> E.bracket (openBackend logFunc) closeBackend $ run . 
f
   where
     openBackend = openWith RawSqlite connInfo
@@ -820,7 +846,7 @@
 --
 -- @since 2.10.6
 createRawSqlitePoolFromInfo
-    :: (MonadLogger m, MonadUnliftIO m)
+    :: (MonadLoggerIO m, MonadUnliftIO m)
     => SqliteConnectionInfo
     -> (RawSqlite SqlBackend -> m ())
     -- ^ An action that is run whenever a new `RawSqlite` connection is
@@ -841,7 +867,7 @@
 --
 -- @since 2.10.6
 createRawSqlitePoolFromInfo_
-    :: (MonadLogger m, MonadUnliftIO m)
+    :: (MonadLoggerIO m, MonadUnliftIO m)
     => SqliteConnectionInfo -> Int -> m (Pool (RawSqlite SqlBackend))
 createRawSqlitePoolFromInfo_ connInfo =
   createRawSqlitePoolFromInfo connInfo (const (return ()))
@@ -850,7 +876,7 @@
 --
 -- @since 2.10.6
 withRawSqlitePoolInfo
-    :: (MonadUnliftIO m, MonadLogger m)
+    :: (MonadUnliftIO m, MonadLoggerIO m)
     => SqliteConnectionInfo
     -> (RawSqlite SqlBackend -> m ())
     -> Int -- ^ number of connections to open
@@ -868,7 +894,7 @@
 --
 -- @since 2.10.6
 withRawSqlitePoolInfo_
-    :: (MonadUnliftIO m, MonadLogger m)
+    :: (MonadUnliftIO m, MonadLoggerIO m)
     => SqliteConnectionInfo
     -> Int -- ^ number of connections to open
     -> (Pool (RawSqlite SqlBackend) -> m a)
@@ -885,29 +911,15 @@
     , _rawSqliteConnection :: Sqlite.Connection -- ^ The underlying 
`Sqlite.Connection`
     }
 
-instance HasPersistBackend b => HasPersistBackend (RawSqlite b) where
-    type BaseBackend (RawSqlite b) = BaseBackend b
-    persistBackend = persistBackend . _persistentBackend
-
 instance BackendCompatible b (RawSqlite b) where
     projectBackend = _persistentBackend
 
-instance (PersistCore b) => PersistCore (RawSqlite b) where
-    newtype BackendKey (RawSqlite b) = RawSqliteKey (BackendKey b)
-
-deriving instance (Show (BackendKey b)) => Show (BackendKey (RawSqlite b))
-deriving instance (Read (BackendKey b)) => Read (BackendKey (RawSqlite b))
-deriving instance (Eq (BackendKey b)) => Eq (BackendKey (RawSqlite b))
-deriving instance (Ord (BackendKey b)) => Ord (BackendKey (RawSqlite b))
-deriving instance (Num (BackendKey b)) => Num (BackendKey (RawSqlite b))
-deriving instance (Integral (BackendKey b)) => Integral (BackendKey (RawSqlite 
b))
-deriving instance (PersistField (BackendKey b)) => PersistField (BackendKey 
(RawSqlite b))
-deriving instance (PersistFieldSql (BackendKey b)) => PersistFieldSql 
(BackendKey (RawSqlite b))
-deriving instance (Real (BackendKey b)) => Real (BackendKey (RawSqlite b))
-deriving instance (Enum (BackendKey b)) => Enum (BackendKey (RawSqlite b))
-deriving instance (Bounded (BackendKey b)) => Bounded (BackendKey (RawSqlite 
b))
-deriving instance (ToJSON (BackendKey b)) => ToJSON (BackendKey (RawSqlite b))
-deriving instance (FromJSON (BackendKey b)) => FromJSON (BackendKey (RawSqlite 
b))
+#if MIN_VERSION_base(4,12,0)
+makeCompatibleInstances [t| forall b. Compatible b (RawSqlite b) |]
+#else
+instance HasPersistBackend b => HasPersistBackend (RawSqlite b) where
+    type BaseBackend (RawSqlite b) = BaseBackend b
+    persistBackend = persistBackend . _persistentBackend
 
 instance (PersistStoreRead b) => PersistStoreRead (RawSqlite b) where
     get = withReaderT _persistentBackend . get
@@ -947,6 +959,31 @@
     upsert rec = withReaderT _persistentBackend . upsert rec
     upsertBy uniq rec = withReaderT _persistentBackend . upsertBy uniq rec
     putMany = withReaderT _persistentBackend . putMany
+#endif
+
+#if MIN_VERSION_base(4,12,0)
+instance (PersistCore b) => PersistCore (RawSqlite b) where
+  newtype BackendKey (RawSqlite b) = RawSqliteKey { unRawSqliteKey :: 
BackendKey (Compatible b (RawSqlite b)) }
+
+makeCompatibleKeyInstances [t| forall b. Compatible b (RawSqlite b) |]
+#else
+instance (PersistCore b) => PersistCore (RawSqlite b) where
+  newtype BackendKey (RawSqlite b) = RawSqliteKey { unRawSqliteKey :: 
BackendKey (RawSqlite b) }
+
+deriving instance (Show (BackendKey b)) => Show (BackendKey (RawSqlite b))
+deriving instance (Read (BackendKey b)) => Read (BackendKey (RawSqlite b))
+deriving instance (Eq (BackendKey b)) => Eq (BackendKey (RawSqlite b))
+deriving instance (Ord (BackendKey b)) => Ord (BackendKey (RawSqlite b))
+deriving instance (Num (BackendKey b)) => Num (BackendKey (RawSqlite b))
+deriving instance (Integral (BackendKey b)) => Integral (BackendKey (RawSqlite 
b))
+deriving instance (PersistField (BackendKey b)) => PersistField (BackendKey 
(RawSqlite b))
+deriving instance (PersistFieldSql (BackendKey b)) => PersistFieldSql 
(BackendKey (RawSqlite b))
+deriving instance (Real (BackendKey b)) => Real (BackendKey (RawSqlite b))
+deriving instance (Enum (BackendKey b)) => Enum (BackendKey (RawSqlite b))
+deriving instance (Bounded (BackendKey b)) => Bounded (BackendKey (RawSqlite 
b))
+deriving instance (ToJSON (BackendKey b)) => ToJSON (BackendKey (RawSqlite b))
+deriving instance (FromJSON (BackendKey b)) => FromJSON (BackendKey (RawSqlite 
b))
+#endif
 
 makeLenses ''RawSqlite
 makeLenses ''SqliteConnectionInfo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.11.1.0/Database/Sqlite.hs 
new/persistent-sqlite-2.12.0.0/Database/Sqlite.hs
--- old/persistent-sqlite-2.11.1.0/Database/Sqlite.hs   2020-11-04 
16:06:50.000000000 +0100
+++ new/persistent-sqlite-2.12.0.0/Database/Sqlite.hs   2021-03-29 
21:25:27.000000000 +0200
@@ -96,7 +96,7 @@
 import Foreign
 import Foreign.C
 
-import Database.Persist (PersistValue (..), listToJSON, mapToJSON)
+import Database.Persist (PersistValue (..), listToJSON, mapToJSON, 
LiteralType(..))
 
 -- | A custom exception type to make it easier to catch exceptions.
 --
@@ -468,13 +468,13 @@
             PersistUTCTime d -> bindText statement parameterIndex $ pack $ 
format8601 d
             PersistList l -> bindText statement parameterIndex $ listToJSON l
             PersistMap m -> bindText statement parameterIndex $ mapToJSON m
-            PersistDbSpecific s -> bindText statement parameterIndex $ 
decodeUtf8With lenientDecode s
             PersistArray a -> bindText statement parameterIndex $ listToJSON a 
-- copy of PersistList's definition
             PersistObjectId _ -> P.error "Refusing to serialize a 
PersistObjectId to a SQLite value"
 
             -- I know one of these is broken, but the docs for 
`sqlite3_bind_text` aren't very illuminating.
-            PersistLiteral l -> bindText statement parameterIndex $ 
decodeUtf8With lenientDecode l
-            PersistLiteralEscaped e -> bindText statement parameterIndex $ 
decodeUtf8With lenientDecode e
+            PersistLiteral_ DbSpecific s -> bindText statement parameterIndex 
$ decodeUtf8With lenientDecode s
+            PersistLiteral_ Unescaped l -> bindText statement parameterIndex $ 
decodeUtf8With lenientDecode l
+            PersistLiteral_ Escaped e -> bindText statement parameterIndex $ 
decodeUtf8With lenientDecode e
             )
        $ zip [1..] sqlData
   return ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.11.1.0/persistent-sqlite.cabal 
new/persistent-sqlite-2.12.0.0/persistent-sqlite.cabal
--- old/persistent-sqlite-2.11.1.0/persistent-sqlite.cabal      2021-02-05 
22:39:24.000000000 +0100
+++ new/persistent-sqlite-2.12.0.0/persistent-sqlite.cabal      2021-03-29 
21:25:27.000000000 +0200
@@ -1,5 +1,5 @@
 name:            persistent-sqlite
-version:         2.11.1.0
+version:         2.12.0.0
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <mich...@snoyman.com>
@@ -44,7 +44,7 @@
 
 library
     build-depends:   base                    >= 4.9         && < 5
-                   , persistent              >= 2.11        && < 3
+                   , persistent              >= 2.12        && < 3
                    , aeson                   >= 1.0
                    , bytestring              >= 0.10
                    , conduit                 >= 1.2.12
@@ -120,7 +120,6 @@
     build-depends:   base >= 4.9 && < 5
                    , persistent
                    , persistent-sqlite
-                   , persistent-template
                    , persistent-test
                    , bytestring
                    , containers

Reply via email to