packages feed

dbcleaner 0.1.0 → 0.1.1

raw patch · 3 files changed

+6/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

dbcleaner.cabal view
@@ -1,5 +1,5 @@ name:           dbcleaner-version:        0.1.0+version:        0.1.1 synopsis:       Clean database tables automatically around hspec tests description:    A simple database cleaner library for testing that provides                 different cleanup strategies.
src/Database/DBCleaner/PostgreSQLSimple.hs view
@@ -12,6 +12,7 @@  import           Database.DBCleaner.Types         (Strategy (..)) +-- | Connection wrapper that cleans up the database using the strategy specified. withConnection :: Strategy -> (Connection -> IO a) -> Connection -> IO a withConnection Transaction f c = bracket (begin c >> return c) rollback f withConnection Truncation f c = finally (f c) $ listTables c >>= mapM_ (truncateTable c)
src/Database/DBCleaner/Types.hs view
@@ -1,3 +1,6 @@ module Database.DBCleaner.Types where -data Strategy = Transaction | Truncation+data Strategy = Transaction -- ^ Wraps all the queries inside a transaction and+                            --   rollback everything once the execution is done.+              | Truncation  -- ^ Truncate all the tables after the execution of+                            --   the queries.