Hello community,

here is the log from the commit of package ghc-persistent-sqlite for 
openSUSE:Factory checked in at 2018-09-03 10:34:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent-sqlite (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-persistent-sqlite.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-persistent-sqlite"

Mon Sep  3 10:34:43 2018 rev:10 rq:632484 version:2.8.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-persistent-sqlite/ghc-persistent-sqlite.changes  
    2018-07-21 10:22:36.670995265 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-persistent-sqlite.new/ghc-persistent-sqlite.changes
 2018-09-03 10:34:43.320610499 +0200
@@ -1,0 +2,10 @@
+Thu Aug 30 15:29:23 UTC 2018 - [email protected]
+
+- Update persistent-sqlite to version 2.8.2.
+  # Changelog for persistent-sqlite
+
+  ## 2.8.2
+
+  * Add the `extraPragmas` setting
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ ghc-persistent-sqlite.spec ++++++
--- /var/tmp/diff_new_pack.CgGLa8/_old  2018-09-03 10:34:43.888611964 +0200
+++ /var/tmp/diff_new_pack.CgGLa8/_new  2018-09-03 10:34:43.888611964 +0200
@@ -19,7 +19,7 @@
 %global pkg_name persistent-sqlite
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        2.8.1.2
+Version:        2.8.2
 Release:        0
 Summary:        Backend for the persistent library using sqlite3
 License:        MIT

++++++ persistent-sqlite-2.8.1.2.tar.gz -> persistent-sqlite-2.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.8.1.2/ChangeLog.md 
new/persistent-sqlite-2.8.2/ChangeLog.md
--- old/persistent-sqlite-2.8.1.2/ChangeLog.md  2018-02-27 05:46:39.000000000 
+0100
+++ new/persistent-sqlite-2.8.2/ChangeLog.md    2018-08-23 05:20:06.000000000 
+0200
@@ -1,3 +1,9 @@
+# Changelog for persistent-sqlite
+
+## 2.8.2
+
+* Add the `extraPragmas` setting
+
 ## 2.8.1.2
 
 * Add flag to enable full-text search extensions (enabled by default)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.8.1.2/Database/Persist/Sqlite.hs 
new/persistent-sqlite-2.8.2/Database/Persist/Sqlite.hs
--- old/persistent-sqlite-2.8.1.2/Database/Persist/Sqlite.hs    2018-02-27 
01:17:42.000000000 +0100
+++ new/persistent-sqlite-2.8.2/Database/Persist/Sqlite.hs      2018-08-23 
05:19:37.000000000 +0200
@@ -24,6 +24,7 @@
     , sqlConnectionStr
     , walEnabled
     , fkEnabled
+    , extraPragmas
     , runSqlite
     , runSqliteInfo
     , wrapConnection
@@ -38,7 +39,7 @@
 
 import Control.Applicative as A
 import qualified Control.Exception as E
-import Control.Monad (when)
+import Control.Monad (forM_)
 import Control.Monad.IO.Unlift (MonadIO (..), MonadUnliftIO, withUnliftIO, 
unliftIO)
 import Control.Monad.Logger (NoLoggingT, runNoLoggingT, MonadLogger)
 import Control.Monad.Trans.Reader (ReaderT, runReaderT)
@@ -130,21 +131,28 @@
                   -> LogFunc
                   -> IO backend
 wrapConnectionInfo connInfo conn logFunc = do
-    when (_walEnabled connInfo) $ do
+    let
         -- Turn on the write-ahead log
         -- https://github.com/yesodweb/persistent/issues/363
-        turnOnWal <- Sqlite.prepare conn "PRAGMA journal_mode=WAL;"
-        _ <- Sqlite.stepConn conn turnOnWal
-        Sqlite.reset conn turnOnWal
-        Sqlite.finalize turnOnWal
+        walPragma
+          | _walEnabled connInfo = ("PRAGMA journal_mode=WAL;":)
+          | otherwise = id
 
-    when (_fkEnabled connInfo) $ do
         -- Turn on foreign key constraints
         -- https://github.com/yesodweb/persistent/issues/646
-        turnOnFK <- Sqlite.prepare conn "PRAGMA foreign_keys = on;"
-        _ <- Sqlite.stepConn conn turnOnFK
-        Sqlite.reset conn turnOnFK
-        Sqlite.finalize turnOnFK
+        fkPragma
+          | _fkEnabled connInfo = ("PRAGMA foreign_keys = on;":)
+          | otherwise = id
+
+        -- Allow arbitrary additional pragmas to be set
+        -- https://github.com/commercialhaskell/stack/issues/4247
+        pragmas = walPragma $ fkPragma $ _extraPragmas connInfo
+
+    forM_ pragmas $ \pragma -> do
+        stmt <- Sqlite.prepare conn pragma
+        _ <- Sqlite.stepConn conn stmt
+        Sqlite.reset conn stmt
+        Sqlite.finalize stmt
 
     smap <- newIORef $ Map.empty
     return . mkPersistBackend $ SqlBackend
@@ -529,11 +537,11 @@
 --
 -- @since 2.6.2
 mkSqliteConnectionInfo :: Text -> SqliteConnectionInfo
-mkSqliteConnectionInfo fp = SqliteConnectionInfo fp True True
+mkSqliteConnectionInfo fp = SqliteConnectionInfo fp True True []
 
 -- | Parses connection options from a connection string. Used only to provide 
deprecated API.
 conStringToInfo :: Text -> SqliteConnectionInfo
-conStringToInfo connStr = SqliteConnectionInfo connStr' enableWal True where
+conStringToInfo connStr = SqliteConnectionInfo connStr' enableWal True [] where
     (connStr', enableWal) = case () of
         ()
             | Just cs <- T.stripPrefix "WAL=on "  connStr -> (cs, True)
@@ -549,6 +557,7 @@
     { _sqlConnectionStr :: Text -- ^ connection string for the database. Use 
@:memory:@ for an in-memory database.
     , _walEnabled :: Bool -- ^ if the write-ahead log is enabled - see 
https://github.com/yesodweb/persistent/issues/363.
     , _fkEnabled :: Bool -- ^ if foreign-key constraints are enabled.
+    , _extraPragmas :: [Text] -- ^ additional pragmas to be set on 
initialization
     } deriving Show
 makeLenses ''SqliteConnectionInfo
 
@@ -558,3 +567,4 @@
         <$> o .: "connectionString"
         <*> o .: "walEnabled"
         <*> o .: "fkEnabled"
+        <*> o .:? "extraPragmas" .!= []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/persistent-sqlite-2.8.1.2/persistent-sqlite.cabal 
new/persistent-sqlite-2.8.2/persistent-sqlite.cabal
--- old/persistent-sqlite-2.8.1.2/persistent-sqlite.cabal       2018-02-27 
05:55:19.000000000 +0100
+++ new/persistent-sqlite-2.8.2/persistent-sqlite.cabal 2018-08-23 
05:20:15.000000000 +0200
@@ -1,5 +1,5 @@
 name:            persistent-sqlite
-version:         2.8.1.2
+version:         2.8.2
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <[email protected]>


Reply via email to