File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway
cardano-db/src/Cardano/Db/Statement Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
12{-# LANGUAGE NumericUnderscores #-}
3+
4+ #if __GLASGOW_HASKELL__ >= 908
25{-# OPTIONS_GHC -Wno-x-partial #-}
6+ #endif
37
48module Test.Cardano.Db.Mock.Unit.Conway.Rollback (
59 simpleRollback ,
Original file line number Diff line number Diff line change @@ -192,12 +192,13 @@ queryBlockNoAndEpochStmt =
192192 -- (where DrepDistr will be inserted). Using the previous block's epoch ensures
193193 -- DrepDistr for the current epoch gets deleted, preventing duplicates
194194 -- when replaying through the epoch boundary.
195+ -- For genesis (block 0), there's no previous block, so use the current epoch.
195196 sql =
196197 TextEnc. encodeUtf8 $
197198 Text. concat
198- [ " SELECT curr.id, prev.epoch_no"
199+ [ " SELECT curr.id, COALESCE( prev.epoch_no, curr.epoch_no) "
199200 , " FROM " <> tableName (Proxy @ a ) <> " curr"
200- , " JOIN " <> tableName (Proxy @ a ) <> " prev ON prev.block_no = $1 - 1"
201+ , " LEFT JOIN " <> tableName (Proxy @ a ) <> " prev ON prev.block_no = $1 - 1"
201202 , " WHERE curr.block_no = $1"
202203 ]
203204
You can’t perform that action at this time.
0 commit comments