@@ -795,18 +795,15 @@ deleteUsingEpochNo trce epochN = do
795
795
liftIO $ updateProgress (Just trce) progressRef 3 " Counting PoolStat records..."
796
796
psc <- runSession mkDbCallStack $ HsqlSes. statement epochN (parameterisedCountWhere @ SC. PoolStat " epoch_no" " > $1" epochEncoder)
797
797
798
- liftIO $ updateProgress (Just trce) progressRef 4 " Counting Reward records... "
799
- rc <- runSession mkDbCallStack $ HsqlSes. statement epochN (parameterisedCountWhere @ SC. Reward " spendable_epoch " " > $1 " epochEncoder )
798
+ liftIO $ updateProgress (Just trce) progressRef 4 " Count completed "
799
+ pure (ec, dc, rrc, psc )
800
800
801
- liftIO $ updateProgress (Just trce) progressRef 5 " Count completed"
802
- pure (ec, dc, rrc, psc, rc)
803
-
804
- let (epochCount, drepCount, rewardRestCount, poolStatCount, rewardCount) = totalCounts
805
- totalRecords = epochCount + drepCount + rewardRestCount + poolStatCount + rewardCount
801
+ let (epochCount, drepCount, rewardRestCount, poolStatCount) = totalCounts
802
+ totalRecords = epochCount + drepCount + rewardRestCount + poolStatCount
806
803
liftIO $ logInfo trce $ " Deleting " <> textShow totalRecords <> " records across 5 tables..."
807
804
808
805
-- Execute deletes with progress logging
809
- (epochDeletedCount, drepDeletedCount, rewardRestDeletedCount, poolStatDeletedCount, rewardDeletedCount ) <-
806
+ (epochDeletedCount, drepDeletedCount, rewardRestDeletedCount, poolStatDeletedCount) <-
810
807
withProgress (Just trce) 5 " Deleting epoch records..." $ \ progressRef -> do
811
808
liftIO $ updateProgress (Just trce) progressRef 1 $ " Deleting " <> textShow epochCount <> " Epochs..."
812
809
epochDeletedCount <- runSession mkDbCallStack $ HsqlSes. statement epochN (deleteWhereCount @ SC. Epoch " no" " =" epochEncoder)
@@ -820,10 +817,7 @@ deleteUsingEpochNo trce epochN = do
820
817
liftIO $ updateProgress (Just trce) progressRef 4 $ " Deleting " <> textShow poolStatCount <> " PoolStat records..."
821
818
poolStatDeletedCount <- runSession mkDbCallStack $ HsqlSes. statement epochN (deleteWhereCount @ SC. PoolStat " epoch_no" " >" epochEncoder)
822
819
823
- liftIO $ updateProgress (Just trce) progressRef 5 $ " Deleting " <> textShow rewardCount <> " Rewards..."
824
- rewardDeletedCount <- runSession mkDbCallStack $ HsqlSes. statement epochN (deleteWhereCount @ SC. Reward " spendable_epoch" " >" epochEncoder)
825
-
826
- pure (epochDeletedCount, drepDeletedCount, rewardRestDeletedCount, poolStatDeletedCount, rewardDeletedCount)
820
+ pure (epochDeletedCount, drepDeletedCount, rewardRestDeletedCount, poolStatDeletedCount)
827
821
828
822
liftIO $ logInfo trce " Setting null values for governance actions..."
829
823
-- Null operations
@@ -838,11 +832,10 @@ deleteUsingEpochNo trce epochN = do
838
832
, (" DrepDistr" , drepDeletedCount)
839
833
, (" RewardRest" , rewardRestDeletedCount)
840
834
, (" PoolStat" , poolStatDeletedCount)
841
- , (" Reward" , rewardDeletedCount)
842
835
]
843
836
nullLogs = [(" GovActionProposal Nulled" , nullTotal)]
844
837
845
- liftIO $ logInfo trce $ " Rollback epoch deletion completed - actual deleted: " <> textShow (epochDeletedCount + drepDeletedCount + rewardRestDeletedCount + poolStatDeletedCount + rewardDeletedCount )
838
+ liftIO $ logInfo trce $ " Rollback epoch deletion completed - actual deleted: " <> textShow (epochDeletedCount + drepDeletedCount + rewardRestDeletedCount + poolStatDeletedCount)
846
839
pure $ countLogs <> nullLogs
847
840
848
841
--------------------------------------------------------------------------------
0 commit comments