Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NumericUnderscores #-}

#if __GLASGOW_HASKELL__ >= 908
{-# OPTIONS_GHC -Wno-x-partial #-}
#endif

module Test.Cardano.Db.Mock.Unit.Conway.Rollback (
simpleRollback,
Expand Down
5 changes: 3 additions & 2 deletions cardano-db/src/Cardano/Db/Statement/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,13 @@ queryBlockNoAndEpochStmt =
-- (where DrepDistr will be inserted). Using the previous block's epoch ensures
-- DrepDistr for the current epoch gets deleted, preventing duplicates
-- when replaying through the epoch boundary.
-- For genesis (block 0), there's no previous block, so use the current epoch.
sql =
TextEnc.encodeUtf8 $
Text.concat
[ "SELECT curr.id, prev.epoch_no"
[ "SELECT curr.id, COALESCE(prev.epoch_no, curr.epoch_no)"
, " FROM " <> tableName (Proxy @a) <> " curr"
, " JOIN " <> tableName (Proxy @a) <> " prev ON prev.block_no = $1 - 1"
, " LEFT JOIN " <> tableName (Proxy @a) <> " prev ON prev.block_no = $1 - 1"
, " WHERE curr.block_no = $1"
]

Expand Down
Loading