From 5b9cb8ba14dc65f7853d424f9eca2dd21273a9c4 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 14 Dec 2014 09:46:18 +0200 Subject: [PATCH] Add ability to skip migrations --- Application.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Application.hs b/Application.hs index c9b80b9..fc9ebd8 100644 --- a/Application.hs +++ b/Application.hs @@ -216,15 +216,18 @@ makeFoundation useEcho conf = do , websiteContent = websiteContent' } + env <- getEnvironment + -- Perform database migration using our application's logging settings. - runResourceT $ + when (lookup "STACKAGE_SKIP_MIGRATION" env /= Just "1") $ + runResourceT $ flip runReaderT gen $ flip runLoggingT (messageLoggerSource foundation logger) $ flip (Database.Persist.runPool dbconf) p $ do runMigration migrateAll checkMigration 1 $ fixSnapSlugs - env <- getEnvironment + let updateDB = lookup "STACKAGE_CABAL_LOADER" env /= Just "0" forceUpdate = lookup "STACKAGE_FORCE_UPDATE" env == Just "1" loadCabalFiles' = appLoadCabalFiles updateDB forceUpdate foundation dbconf p