Skip to content

Commit

Permalink
Merge pull request #873 from input-output-hk/erikd/many-rewards
Browse files Browse the repository at this point in the history
db: Handle empty list in insertManyUncheckedUnique
  • Loading branch information
erikd authored Oct 5, 2021
2 parents df938f8 + bc396a6 commit 31cf28b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cardano-db/src/Cardano/Db/Insert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module Cardano.Db.Insert


import Control.Exception.Lifted (Exception, handle, throwIO)
import Control.Monad (void, when)
import Control.Monad (unless, void, when)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Trans.Reader (ReaderT)
Expand Down Expand Up @@ -242,8 +242,9 @@ insertManyUncheckedUnique
, OnlyOneUniqueKey record
)
=> String -> [record] -> ReaderT SqlBackend m ()
insertManyUncheckedUnique vtype records = do
handle exceptHandler (rawExecute query values)
insertManyUncheckedUnique vtype records =
unless (null records) $
handle exceptHandler (rawExecute query values)
where
query :: Text
query =
Expand Down

0 comments on commit 31cf28b

Please sign in to comment.