Don't update DB schema version if equal to app's version
This commit is contained in:
parent
dc74456a6a
commit
7218262223
1 changed files with 4 additions and 3 deletions
|
@ -55,9 +55,10 @@ runMigrations
|
||||||
runMigrations sb migrations = do
|
runMigrations sb migrations = do
|
||||||
dver <- fromMaybe 0 <$> getDbSchemaVersion
|
dver <- fromMaybe 0 <$> getDbSchemaVersion
|
||||||
let aver = length migrations
|
let aver = length migrations
|
||||||
if aver < dver
|
case compare aver dver of
|
||||||
then error "Older app version running with newer DB schema version"
|
LT -> error "Older app version running with newer DB schema version"
|
||||||
else do
|
EQ -> return ()
|
||||||
|
GT -> do
|
||||||
let migs = drop dver migrations
|
let migs = drop dver migrations
|
||||||
runReaderT (sequence migs) sb
|
runReaderT (sequence migs) sb
|
||||||
setDbSchemaVersion aver
|
setDbSchemaVersion aver
|
||||||
|
|
Loading…
Reference in a new issue