Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
getMigrations should also have a getMigrations'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrevdm committed Oct 12, 2019
1 parent 9a440d4 commit 121f9d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Database/PostgreSQL/Simple/Migration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Database.PostgreSQL.Simple.Migration

-- * Migration result actions
, getMigrations
, getMigrations'

-- * Migration result types
, SchemaMigration(..)
Expand Down Expand Up @@ -337,10 +338,14 @@ data MigrationContext' = MigrationContext'
, migrationTableName :: !BS.ByteString
-- ^ The name of the table that stores the migrations
}
--
-- | Produces a list of all executed 'SchemaMigration's.
getMigrations :: Connection -> IO [SchemaMigration]
getMigrations con = getMigrations' con "schema_migrations"

-- | Produces a list of all executed 'SchemaMigration's.
getMigrations :: Connection -> BS.ByteString -> IO [SchemaMigration]
getMigrations con tableName = query_ con q
getMigrations' :: Connection -> BS.ByteString -> IO [SchemaMigration]
getMigrations' con tableName = query_ con q
where q = mconcat
[ "select filename, checksum, executed_at "
, "from " <> Query tableName <> " order by executed_at asc"
Expand Down

0 comments on commit 121f9d7

Please sign in to comment.