morph 0.1.0.1 → 0.1.1.1
raw patch · 4 files changed
+9/−6 lines, 4 files
Files
- Main.hs +1/−1
- morph.cabal +2/−2
- src/Morph/Migrator.hs +3/−3
- src/Morph/Options.hs +3/−0
Main.hs view
@@ -7,4 +7,4 @@ opts <- getOptions config <- readConfigOrDie opts withConnection config $ \conn -> do- migrate conn $ optsMigrationsDirectory opts+ migrate (optsTransaction opts) conn (optsMigrationsDirectory opts)
morph.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: morph-version: 0.1.0.1+version: 0.1.1.1 synopsis: A simple database migrator for PostgreSQL description: Morph is a tool to migrate your PostgreSQL databases safely which supports rollbacks.@@ -16,7 +16,7 @@ source-repository head type: darcs location: http://darcs.redspline.com/morph- tag: 0.1.0.1+ tag: 0.1.1.1 library hs-source-dirs: src
src/Morph/Migrator.hs view
@@ -98,8 +98,8 @@ void $ execute conn "INSERT INTO migrations (id, rollback_sql) VALUES (?, ?)" (migrationIdentifier migration, down) -migrate :: Connection -> FilePath -> IO ()-migrate conn dir = do+migrate :: Bool -> Connection -> FilePath -> IO ()+migrate inTransaction conn dir = do createMigrationTable conn doneMigrations <- listDone conn@@ -117,6 +117,6 @@ toDo = filter ((`elem` toDoIdentifiers) . migrationIdentifier) goalMigrations - withTransaction conn $ do+ (if inTransaction then withTransaction conn else id) $ do forM_ toRollback $ rollbackMigration conn forM_ toDo $ doMigration conn
src/Morph/Options.hs view
@@ -12,6 +12,7 @@ , optsKeysPath :: [T.Text] , optsMigrationsDirectory :: FilePath , optsJSONConfig :: Bool+ , optsTransaction :: Bool } optionsParser :: Parser Options@@ -28,6 +29,8 @@ <> help "Path to the directory containing migrations.") <*> flag False True (short 'j' <> long "json" <> help "Read config file as JSON.")+ <*> flag True False (long "no-transaction"+ <> help "Do not run migrations in a SQL transaction. ") getOptions :: IO Options getOptions = execParser $ info (helper <*> optionsParser) $