From 22f5a655c5b1d655bad466c18e7332ced96a8103 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 18 May 2019 23:51:50 +0200 Subject: [PATCH] Don't crash on unsafe migrations --- src/Model/Migration.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Migration.hs b/src/Model/Migration.hs index f220e4353..9c8b1578b 100644 --- a/src/Model/Migration.hs +++ b/src/Model/Migration.hs @@ -79,7 +79,7 @@ migrateAll = do requiresMigration :: forall m. (MonadLogger m, MonadBaseControl IO m, MonadIO m) => ReaderT SqlBackend m Bool requiresMigration = mapReaderT (exceptT return return) $ do - initial <- getMigration initialMigration + initial <- either id (map snd) <$> parseMigration initialMigration when (not $ null initial) $ do $logInfoS "Migration" $ intercalate "; " initial throwError True @@ -89,7 +89,7 @@ requiresMigration = mapReaderT (exceptT return return) $ do $logInfoS "Migration" . intercalate ", " . map tshow $ Map.keys customs throwError True - automatic <- getMigration migrateAll' + automatic <- either id (map snd) <$> parseMigration migrateAll' when (not $ null automatic) $ do $logInfoS "Migration" $ intercalate "; " automatic throwError True