Skip to content

Commit

Permalink
Version bump to 2.6.2 for #646
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Mar 3, 2017
1 parent c20236f commit dcd64f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions persistent-sqlite/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 2.6.1.1
## 2.6.2

* Removed the behaviour of toggling write-ahead log (WAL) based on a prefix in the connection string, in favour of using a record.
* Turned on foreign key constraints [#646](https://github.com/yesodweb/persistent/issues/646)
* Added new `SqliteConnectionInfo`-based API

## 2.6.1

Expand Down
23 changes: 19 additions & 4 deletions persistent-sqlite/Database/Persist/Sqlite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ createSqlitePool = createSqlitePoolFromInfo . conStringToInfo
-- 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'.
--
-- @since 2.6.2
createSqlitePoolFromInfo :: (MonadIO m, MonadLogger m, MonadBaseControl IO m, IsSqlBackend backend)
=> SqliteConnectionInfo -> Int -> m (Pool backend)
createSqlitePoolFromInfo connInfo = createSqlPool $ open' connInfo
Expand All @@ -92,6 +94,8 @@ withSqlitePool connInfo = withSqlPool . open' $ conStringToInfo connInfo
-- | Run the given action with a connection pool.
--
-- Like 'createSqlitePool', this should not be used with @:memory:@.
--
-- @since 2.6.2
withSqlitePoolInfo :: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend)
=> SqliteConnectionInfo
-> Int -- ^ number of connections to open
Expand All @@ -102,6 +106,7 @@ withSqliteConn :: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend
=> Text -> (backend -> m a) -> m a
withSqliteConn = withSqliteConnInfo . conStringToInfo

-- | @since 2.6.2
withSqliteConnInfo :: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend)
=> SqliteConnectionInfo -> (backend -> m a) -> m a
withSqliteConnInfo = withSqlConn . open'
Expand All @@ -117,7 +122,10 @@ open' connInfo logFunc = do
wrapConnection :: (IsSqlBackend backend) => Sqlite.Connection -> LogFunc -> IO backend
wrapConnection = wrapConnectionInfo (mkSqliteConnectionInfo "")

-- | Wrap up a raw 'Sqlite.Connection' as a Persistent SQL 'Connection', allowing full control over WAL and FK constraints.
-- | Wrap up a raw 'Sqlite.Connection' as a Persistent SQL
-- 'Connection', allowing full control over WAL and FK constraints.
--
-- @since 2.6.2
wrapConnectionInfo :: (IsSqlBackend backend)
=> SqliteConnectionInfo
-> Sqlite.Connection
Expand Down Expand Up @@ -184,7 +192,7 @@ runSqlite connstr = runResourceT
-- given block, handling @MonadResource@ and @MonadLogger@ requirements. Note
-- that all log messages are discarded.
--
-- Since 1.1.4
-- @since 2.6.2
runSqliteInfo :: (MonadBaseControl IO m, MonadIO m, IsSqlBackend backend)
=> SqliteConnectionInfo
-> ReaderT backend (NoLoggingT (ResourceT m)) a -- ^ database action
Expand Down Expand Up @@ -515,7 +523,10 @@ finally a sequel = control $ \runInIO ->
E.finally (runInIO a)
(runInIO sequel)
{-# INLINABLE finally #-}
-- | Creates a SqliteConnectionInfo from a connection string, with the default settings.
-- | Creates a SqliteConnectionInfo from a connection string, with the
-- default settings.
--
-- @since 2.6.2
mkSqliteConnectionInfo :: Text -> SqliteConnectionInfo
mkSqliteConnectionInfo fp = SqliteConnectionInfo fp True True

Expand All @@ -528,7 +539,11 @@ conStringToInfo connStr = SqliteConnectionInfo connStr' enableWal True where
| Just cs <- T.stripPrefix "WAL=off " connStr -> (cs, False)
| otherwise -> (connStr, True)

-- | Information required to connect to a sqlite database. We export lenses instead of fields to avoid being limited to the current implementation.
-- | Information required to connect to a sqlite database. We export
-- lenses instead of fields to avoid being limited to the current
-- implementation.
--
-- @since 2.6.2
data SqliteConnectionInfo = SqliteConnectionInfo
{ _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.
Expand Down
2 changes: 1 addition & 1 deletion persistent-sqlite/persistent-sqlite.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-sqlite
version: 2.6.1.1
version: 2.6.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down

0 comments on commit dcd64f3

Please sign in to comment.