Don't crash on unsafe migrations
This commit is contained in:
parent
813d446975
commit
22f5a655c5
@ -79,7 +79,7 @@ migrateAll = do
|
|||||||
|
|
||||||
requiresMigration :: forall m. (MonadLogger m, MonadBaseControl IO m, MonadIO m) => ReaderT SqlBackend m Bool
|
requiresMigration :: forall m. (MonadLogger m, MonadBaseControl IO m, MonadIO m) => ReaderT SqlBackend m Bool
|
||||||
requiresMigration = mapReaderT (exceptT return return) $ do
|
requiresMigration = mapReaderT (exceptT return return) $ do
|
||||||
initial <- getMigration initialMigration
|
initial <- either id (map snd) <$> parseMigration initialMigration
|
||||||
when (not $ null initial) $ do
|
when (not $ null initial) $ do
|
||||||
$logInfoS "Migration" $ intercalate "; " initial
|
$logInfoS "Migration" $ intercalate "; " initial
|
||||||
throwError True
|
throwError True
|
||||||
@ -89,7 +89,7 @@ requiresMigration = mapReaderT (exceptT return return) $ do
|
|||||||
$logInfoS "Migration" . intercalate ", " . map tshow $ Map.keys customs
|
$logInfoS "Migration" . intercalate ", " . map tshow $ Map.keys customs
|
||||||
throwError True
|
throwError True
|
||||||
|
|
||||||
automatic <- getMigration migrateAll'
|
automatic <- either id (map snd) <$> parseMigration migrateAll'
|
||||||
when (not $ null automatic) $ do
|
when (not $ null automatic) $ do
|
||||||
$logInfoS "Migration" $ intercalate "; " automatic
|
$logInfoS "Migration" $ intercalate "; " automatic
|
||||||
throwError True
|
throwError True
|
||||||
|
|||||||
Reference in New Issue
Block a user