From f28b03f419086e59db107350d8881de1f3b735e8 Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Thu, 25 Feb 2016 20:13:03 -0800 Subject: [PATCH] Allow new hasql-transaction to do rollbacks --- postgrest.cabal | 2 +- src/PostgREST/Main.hs | 7 +------ stack.yaml | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/postgrest.cabal b/postgrest.cabal index 406f6184b..af14992f3 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -36,7 +36,7 @@ executable postgrest , errors , hasql >= 0.19.3.3 && < 0.20 , hasql-pool >= 0.4 && < 0.5 - , hasql-transaction >= 0.4 && < 0.5 + , hasql-transaction >= 0.4.3 && < 0.5 , http-types , interpolatedstring-perl6 , jwt diff --git a/src/PostgREST/Main.hs b/src/PostgREST/Main.hs index 98efe5f19..ae840249d 100644 --- a/src/PostgREST/Main.hs +++ b/src/PostgREST/Main.hs @@ -14,7 +14,6 @@ import PostgREST.Middleware import PostgREST.Types (DbStructure) import Control.Monad -import Control.Monad.Error.Class (catchError, throwError) import Data.Monoid ((<>)) import Data.String.Conversions (cs) import Data.Time.Clock.POSIX (getPOSIXTime) @@ -96,9 +95,5 @@ postgrest conf dbStructure pool = let handleReq = runWithClaims conf time (app dbStructure conf body) req resp <- either pgErrResponse id <$> P.use pool - (rollbackOnError $ HT.run handleReq HT.ReadCommitted HT.Write) + (HT.run handleReq HT.ReadCommitted HT.Write) respond resp - - where - rollbackOnError :: H.Session a -> H.Session a - rollbackOnError = (`catchError` ((H.sql "rollback;" >>) . throwError)) diff --git a/stack.yaml b/stack.yaml index b982cdd49..250e65033 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,7 +4,7 @@ extra-deps: - bytestring-tree-builder-0.2.5 - hasql-0.19.8 - hasql-pool-0.4 - - hasql-transaction-0.4.2 + - hasql-transaction-0.4.3 - packdeps-0.4.2.1 - postgresql-error-codes-1 - postgresql-binary-0.8.1