Skip to content
Snippets Groups Projects
Commit 06e6471f authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

split a bit of this expression into a separate function

no point really except maybe it is easier to read?  I was trying to remove a
level of nesting but I failed.
parent 91e58ce2
Branches
No related tags found
1 merge request!80Fix the charge/voucher metadata mismatch error handling case
......@@ -467,13 +467,16 @@ upgradeSchema targetVersion conn = do
errOrCurrentVersion <- readVersion conn
case errOrCurrentVersion of
Left err -> return $ Left err
Right currentVersion ->
Right currentVersion -> perhapsUpgrade targetVersion currentVersion
where
perhapsUpgrade :: Int -> Int -> IO (Either UpgradeError ())
perhapsUpgrade targetVersion currentVersion =
case compareVersion targetVersion currentVersion of
Lesser -> return $ Left DatabaseSchemaTooNew
Equal -> return $ Right ()
Greater -> runUpgrades currentVersion targetVersion
where
runUpgrades :: Int -> Int -> IO (Either UpgradeError ())
runUpgrades currentVersion targetVersion =
let
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment