persistent-sqlite-2.2.1.1: Backend for the persistent library using sqlite3.

Safe HaskellNone
LanguageHaskell98

Database.Persist.Sqlite

Description

A sqlite backend for persistent.

Note: If you prepend WAL=off to your connection string, it will disable the write-ahead log. For more information, see https://github.com/yesodweb/persistent/issues/363.

Synopsis

Documentation

withSqlitePool Source #

Arguments

:: (MonadBaseControl IO m, MonadIO m, MonadLogger m) 
=> Text 
-> Int

number of connections to open

-> (ConnectionPool -> m a) 
-> m a 

Run the given action with a connection pool.

Like createSqlitePool, this should not be used with :memory:.

createSqlitePool :: (MonadIO m, MonadLogger m, MonadBaseControl IO m) => Text -> Int -> m ConnectionPool Source #

Create a pool of SQLite connections.

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.

runSqlite Source #

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> Text

connection string

-> SqlPersistT (NoLoggingT (ResourceT m)) a

database action

-> m a 

A convenience helper which creates a new database connection and runs the given block, handling MonadResource and MonadLogger requirements. Note that all log messages are discarded.

Since 1.1.4

wrapConnection :: Connection -> LogFunc -> IO SqlBackend Source #

Wrap up a raw Connection as a Persistent SQL Connection.

Since 1.1.5

mockMigration :: Migration -> IO () Source #

Mock a migration even when the database is not present. This function performs the same functionality of printMigration with the difference that an actualy database isn't needed for it.