packages feed

tmp-postgres 1.30.0.1 → 1.31.0.0

raw patch · 5 files changed

+29/−42 lines, 5 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ Changelog for tmp-postgres +1.31.0.0+  #224 Remove defaultPostgresConf+  #223 Doc fixes+ 1.30.0.1   #221 Make verboseConfig support pgbadger   #218 Document difference between takeSnapshot and cacheAction
src/Database/Postgres/Temp.hs view
@@ -55,7 +55,6 @@   -- *** Defaults   , defaultConfig   , defaultConfig_9_3_10-  , defaultPostgresConf   , verboseConfig   -- *** Custom Config builder helpers   , optionsToDefaultConfig
src/Database/Postgres/Temp/Internal.hs view
@@ -131,6 +131,10 @@   , ("log_min_error_statement", "PANIC")   , ("log_statement", "none")   , ("client_min_messages", "ERROR")+  , ("commit_delay", "100000")+  , ("wal_level", "minimal")+  , ("archive_mode", "off")+  , ("max_wal_senders", "0")   ]  {-|@@ -150,6 +154,10 @@ log_min_error_statement = PANIC log_statement = none client_min_messages = ERROR+commit_delay = 100000+wal_level = minimal+archive_mode = off+max_wal_senders = 0 @  'defaultConfig' also passes the @--no-sync@ flag to @initdb@.@@ -219,24 +227,6 @@     }   } --{-|-'mappend' the 'defaultConfig' with a 'Config' that provides additional-   \"postgresql.conf\" lines. Equivalent to:--@-'defaultPostgresConf' extra = 'defaultConfig' <> mempty-  { 'postgresConfigFile' = extra-  }-@--@since 1.21.0.0--}-defaultPostgresConf :: [(String, String)] -> Config-defaultPostgresConf extra = defaultConfig <> mempty-  { postgresConfigFile = extra-  }- -- | Default postgres options -- --   @since 1.21.0.0@@ -707,16 +697,14 @@   let result = config <> fromFilePathConfig fixCachePath   nonEmpty <- doesFileExist $ fixCachePath <> "/PG_VERSION" -  case nonEmpty of-    True -> pure $ pure result-    False -> fmap join $ withConfig config $ \db -> do-      action db-      -- TODO see if parallel is better-      throwIfNotSuccess id =<< stopPostgresGracefully db-      createDirectoryIfMissing True fixCachePath+  if nonEmpty then pure $ pure result else fmap join $ withConfig config $ \db -> do+    action db+    -- TODO see if parallel is better+    throwIfNotSuccess id =<< stopPostgresGracefully db+    createDirectoryIfMissing True fixCachePath -      let snapshotCopyCmd = cpFlags <>-            toDataDirectory db <> "/* " <> fixCachePath-      system snapshotCopyCmd >>= \case-        ExitSuccess -> pure $ pure result-        x -> pure $ Left $ SnapshotCopyFailed snapshotCopyCmd x+    let snapshotCopyCmd = cpFlags <>+          toDataDirectory db <> "/* " <> fixCachePath+    system snapshotCopyCmd >>= \case+      ExitSuccess -> pure $ pure result+      x -> pure $ Left $ SnapshotCopyFailed snapshotCopyCmd x
test/Main.hs view
@@ -382,11 +382,6 @@       either throwIO pure <=< withConfig (cacheConfig cacheInfo <> verboseConfig) $ \db -> do         assertConnection db         withConn db $ \conn -> countDbs conn `shouldReturn` 3--  it "postgresql.conf append last wins" $-    withConfig' (verboseConfig <> defaultPostgresConf [("fsync", "on")]) $ \db -> do-      toPostgresqlConfigFile db `shouldContain` "fsync=on"-      withConn db $ \conn -> countDbs conn `shouldReturn` 3 -- -- Error Plans. Can't be combined. Just list them out inline since they can't be combined --@@ -683,11 +678,12 @@     shouldSatisfy (Set.fromList $ words dbString) $       Set.isSubsetOf wordsToSearchFor -  let justBackupResources = defaultPostgresConf-        [ ("wal_level", "replica")-        , ("archive_mode","on")-        , ("max_wal_senders","2")-        ]+  let justBackupResources = mempty { postgresConfigFile =+          [ ("wal_level", "replica")+          , ("archive_mode","on")+          , ("max_wal_senders","2")+          ]+        }       backupResources = justBackupResources    it "can support backup and restore" $ withConfig' backupResources $ \db@DB {..} -> do
tmp-postgres.cabal view
@@ -1,5 +1,5 @@ name:                tmp-postgres-version:             1.30.0.1+version:             1.31.0.0 synopsis: Start and stop a temporary postgres description: Start and stop a temporary postgres. See README.md homepage:            https://github.com/jfischoff/tmp-postgres#readme