From 72182622239e7e23d853768a331198be4026498e Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Wed, 31 Aug 2016 17:12:20 +0000 Subject: [PATCH] Don't update DB schema version if equal to app's version --- src/Vervis/Migration.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index c341b9e..8cfe385 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -55,9 +55,10 @@ runMigrations runMigrations sb migrations = do dver <- fromMaybe 0 <$> getDbSchemaVersion let aver = length migrations - if aver < dver - then error "Older app version running with newer DB schema version" - else do + case compare aver dver of + LT -> error "Older app version running with newer DB schema version" + EQ -> return () + GT -> do let migs = drop dver migrations runReaderT (sequence migs) sb setDbSchemaVersion aver