Skip to content

Commit

Permalink
Fix build against latest haskell-platform (ghc-8.4.3, cabal-2.2.0.0 w…
Browse files Browse the repository at this point in the history
…ith library 2.2.0.0)
  • Loading branch information
Vitalii Guzeev committed Sep 13, 2018
1 parent c9ba4a4 commit 3cb04cd
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
3 changes: 1 addition & 2 deletions dbmigrations.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ test-suite dbmigrations-tests
FilesystemTest
MigrationsTest
StoreTest
TestDriver
InMemoryStore
LinearMigrationsTest
ConfigurationTest
Expand All @@ -151,7 +150,7 @@ test-suite dbmigrations-tests
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields

Hs-Source-Dirs: src,test
Main-is: TestDriver.hs
Main-is: Main.hs

Executable moo
default-language: Haskell2010
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Schema/Migrations/Backend/HDBC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hdbcBackend conn =

, applyMigration = \m -> do
runRaw conn (mApply m)
run conn ("INSERT INTO " ++ migrationTableName ++
_ <- run conn ("INSERT INTO " ++ migrationTableName ++
" (migration_id) VALUES (?)") [toSql $ mId m]
return ()

Expand All @@ -59,7 +59,7 @@ hdbcBackend conn =
Nothing -> return ()
Just query -> runRaw conn query
-- Remove migration from installed_migrations in either case.
run conn ("DELETE FROM " ++ migrationTableName ++
_ <- run conn ("DELETE FROM " ++ migrationTableName ++
" WHERE migration_id = ?") [toSql $ mId m]
return ()

Expand Down
6 changes: 3 additions & 3 deletions src/Database/Schema/Migrations/Filesystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Database.Schema.Migrations.Filesystem
)
where

import Prelude hiding ( catch )
import Prelude

import System.Directory ( getDirectoryContents, doesFileExist )
import System.FilePath ( (</>), takeExtension, dropExtension, takeBaseName )
Expand Down Expand Up @@ -101,14 +101,14 @@ migrationFromPath path = do
(Right <$> process name) `catch` (\(FilesystemStoreError s) -> return $ Left $ "Could not parse migration " ++ path ++ ":" ++ s)

where
readMigrationFile path = do
readMigrationFile = do
ymlExists <- doesFileExist (addNewMigrationExtension path)
if ymlExists
then parseYamlFile (addNewMigrationExtension path) `catch` (\(e::IOException) -> throwFS $ show e)
else parseYamlFile (addLegacyMigrationExtension path) `catch` (\(e::IOException) -> throwFS $ show e)

process name = do
yaml <- readMigrationFile path
yaml <- readMigrationFile

-- Convert yaml structure into basic key/value map
let fields = getFields yaml
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Schema/Migrations/Test/BackendTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ applyMigrationFailure conn = do
m2 = (newMigration "third") { mApply = "INVALID SQL" }

-- Apply the migrations, ignore exceptions
ignoreSqlExceptions conn $ withTransaction conn $ \conn' -> do
_ <- ignoreSqlExceptions conn $ withTransaction conn $ \conn' -> do
let backend' = makeBackend conn'
applyMigration backend' m1
applyMigration backend' m2
Expand All @@ -129,7 +129,7 @@ revertMigrationFailure conn = do

-- Revert the migrations, ignore exceptions; the revert will fail,
-- but withTransaction will roll back.
ignoreSqlExceptions conn $ withTransaction conn $ \conn' -> do
_ <- ignoreSqlExceptions conn $ withTransaction conn $ \conn' -> do
let backend' = makeBackend conn'
revertMigration backend' m2
revertMigration backend' m1
Expand Down
10 changes: 5 additions & 5 deletions src/Moo/CommandHandlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ reinstallCommand storeData = do
ensureBootstrappedBackend backend >> commitBackend backend
m <- lookupMigration storeData migrationId

revert m storeData backend
apply m storeData backend True
_ <- revert m storeData backend
_ <- apply m storeData backend True

case isTesting of
False -> do
Expand All @@ -130,7 +130,7 @@ applyCommand storeData = do
withBackend $ \backend -> do
ensureBootstrappedBackend backend >> commitBackend backend
m <- lookupMigration storeData migrationId
apply m storeData backend True
_ <- apply m storeData backend True
case isTesting of
False -> do
commitBackend backend
Expand All @@ -148,7 +148,7 @@ revertCommand storeData = do
withBackend $ \backend -> do
ensureBootstrappedBackend backend >> commitBackend backend
m <- lookupMigration storeData migrationId
revert m storeData backend
_ <- revert m storeData backend

case isTesting of
False -> do
Expand All @@ -170,7 +170,7 @@ testCommand storeData = do
-- If the migration is already installed, remove it as part of
-- the test
when (not $ migrationId `elem` migrationNames) $
do revert m storeData backend
do _ <- revert m storeData backend
return ()
applied <- apply m storeData backend True
forM_ (reverse applied) $ \migration -> do
Expand Down
1 change: 0 additions & 1 deletion src/Moo/CommandUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Moo.CommandUtils
, getCurrentTimestamp
) where

import Control.Applicative
import Control.Exception ( finally )
import Control.Monad ( when, forM_, unless )
import Control.Monad.Reader ( asks )
Expand Down
1 change: 0 additions & 1 deletion src/Moo/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Moo.Core
, envStoreName
, loadConfiguration) where

import Control.Applicative
import Control.Monad.Reader (ReaderT)
import qualified Data.Configurator as C
import Data.Configurator.Types (Config, Configured)
Expand Down
File renamed without changes.

0 comments on commit 3cb04cd

Please sign in to comment.