pgmq-migration 0.6.0.0 → 0.6.1.0
raw patch · 3 files changed
+45/−6 lines, 3 filesdep +unixdep ~ephemeral-pgPVP ok
version bump matches the API change (PVP)
Dependencies added: unix
Dependency ranges changed: ephemeral-pg
API changes (from Hackage documentation)
Files
- CHANGELOG.md +10/−0
- pgmq-migration.cabal +3/−2
- test/Main.hs +32/−4
CHANGELOG.md view
@@ -1,5 +1,15 @@ # Changelog for pgmq-migration +## 0.6.1.0 -- 2026-09-16++Coordinated family version bump; the migration ledger and validators are unchanged+from 0.6.0.0.++The test suite now requires `ephemeral-pg >=0.3.1.0` and pins its temporary PostgreSQL+clusters to `/tmp/ephpg-pgmq-hs-<uid>`, so a run killed mid-test leaves a postmaster a later+run can reap. It therefore depends on `unix` to read the effective uid. No library+dependency changed.+ ## 0.6.0.0 -- 2026-09-10 Native installs now reach tagged PGMQ 1.13.0 through append-only migrations 0004–0006:
pgmq-migration.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name: pgmq-migration-version: 0.6.0.0+version: 0.6.1.0 synopsis: PGMQ schema migrations without PostgreSQL extension description: Installs the PGMQ schema into PostgreSQL without requiring the pgmq extension.@@ -80,7 +80,7 @@ bytestring, containers, directory,- ephemeral-pg >=0.2.1,+ ephemeral-pg >=0.3.1.0, hasql, pg-migrate, pg-migrate-import-hasql-migration,@@ -88,3 +88,4 @@ tasty ^>=1.5, tasty-hunit ^>=0.10, text,+ unix,
test/Main.hs view
@@ -10,6 +10,7 @@ import Data.Foldable (toList) import Data.List.NonEmpty (NonEmpty (..)) import Data.Map.Strict qualified as Map+import Data.Monoid (Last (..)) import Data.Text (Text) import Data.Text qualified as T import Data.Text.Encoding qualified as Text@@ -59,8 +60,11 @@ -- of the same name imported above, so it is reached through this alias only. import Database.PostgreSQL.Migrate.Internal qualified as MigrateInternal import EphemeralPg- ( connectionSettings,- withCached,+ ( Config (temporaryRoot),+ connectionSettings,+ defaultCacheConfig,+ defaultConfig,+ withCachedConfig, ) import Hasql.Connection qualified as Connection import Hasql.Connection.Settings qualified as Settings@@ -78,14 +82,38 @@ pgmqHasqlMigrationSourceConfig, pgmqHasqlMigrationSourceConfigWithPolicy, )-import System.Directory (doesFileExist)+import System.Directory (createDirectoryIfMissing, doesFileExist) import System.Environment (lookupEnv)+import System.Posix.User (getEffectiveUserID) import Test.Tasty (TestTree, defaultMain, testGroup) import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=)) +-- | Root directory for ephemeral PostgreSQL clusters.+--+-- ephemeral-pg reaps abandoned clusters at startup, but only within its own+-- temporary root. With 'temporaryRoot' unset that root is @$TMPDIR@, which+-- @nix develop@ makes unique per shell, so a run never reclaims what an earlier+-- session abandoned. Pinning one root across sessions keeps them reachable.+--+-- The path is keyed by effective uid. It is a fixed location created @0700@, so+-- a run under a different user -- the Nix build sandbox -- must not collide with+-- a directory it cannot write to.+ephemeralRoot :: IO FilePath+ephemeralRoot = do+ uid <- getEffectiveUserID+ pure ("/tmp/ephpg-pgmq-hs-" <> show uid)++-- | Cached-startup configuration pinned to 'ephemeralRoot'.+ephemeralConfig :: IO Config+ephemeralConfig = do+ root <- ephemeralRoot+ createDirectoryIfMissing True root+ pure defaultConfig {temporaryRoot = Last (Just root)}+ main :: IO () main = do- result <- withCached $ \db -> do+ config <- ephemeralConfig+ result <- withCachedConfig config defaultCacheConfig $ \db -> do let connSettings = connectionSettings db connResult <- Connection.acquire connSettings case connResult of