[CLI] rollback changes when panic occurs

parent 2e22eac8
Pipeline #7875 passed with stages
in 47 minutes and 11 seconds
...@@ -79,6 +79,7 @@ fixBrokenHyperdata630CLI (DBFixArgs { settings_toml, dry_run }) = do ...@@ -79,6 +79,7 @@ fixBrokenHyperdata630CLI (DBFixArgs { settings_toml, dry_run }) = do
-- Check that the hyperdata can be fetched correctly -- Check that the hyperdata can be fetched correctly
newHd <- runPGSQuery c [sql|SELECT hyperdata FROM contexts WHERE id = ?|] (PSQL.Only cId) :: IO [PSQL.Only HyperdataDocument] newHd <- runPGSQuery c [sql|SELECT hyperdata FROM contexts WHERE id = ?|] (PSQL.Only cId) :: IO [PSQL.Only HyperdataDocument]
unless (length newHd == 1) $ do unless (length newHd == 1) $ do
PSQL.rollback c
panicTrace $ "[" <> show cId <> "] Error! Can't get new hyperdata: " <> show newHd panicTrace $ "[" <> show cId <> "] Error! Can't get new hyperdata: " <> show newHd
putText $ "[" <> show cId <> "] updated correctly" putText $ "[" <> show cId <> "] updated correctly"
) affectedContexts ) affectedContexts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment