Don't crash on unsafe migrations

This commit is contained in:
Gregor Kleen 2019-05-18 23:51:50 +02:00
parent 813d446975
commit 22f5a655c5

View File

@ -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