-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PostgreSQL Schema Migrations -- -- A PostgreSQL-simple schema migration utility @package postgresql-simple-migration @version 0.1.15.0 -- | A collection of utilites for database migrations. module Database.PostgreSQL.Simple.Util -- | Checks if the table with the given name exists in the database. existsTable :: Connection -> String -> IO Bool -- | Executes the given IO monad inside a transaction and performs a -- roll-back afterwards (even if exceptions occur). withTransactionRolledBack :: Connection -> IO a -> IO a -- | A migration library for postgresql-simple. -- -- For usage, see Readme.markdown. module Database.PostgreSQL.Simple.Migration -- | Executes migrations inside the provided MigrationContext. -- -- Returns MigrationSuccess if the provided -- MigrationCommand executes without error. If an error occurs, -- execution is stopped and a MigrationError is returned. -- -- It is recommended to wrap runMigration inside a database -- transaction. runMigration :: MigrationContext -> IO (MigrationResult String) -- | Execute a sequence of migrations -- -- Returns MigrationSuccess if all of the provided -- MigrationCommands execute without error. If an error occurs, -- execution is stopped and the MigrationError is returned. -- -- It is recommended to wrap runMigrations inside a database -- transaction. runMigrations :: Bool -> Connection -> [MigrationCommand] -> IO (MigrationResult String) -- | Run a sequence of contexts, stopping on the first failure sequenceMigrations :: Monad m => [m (MigrationResult e)] -> m (MigrationResult e) -- | The MigrationContext provides an execution context for -- migrations. data MigrationContext MigrationContext :: MigrationCommand -> Bool -> Connection -> MigrationContext -- | The action that will be performed by runMigration [migrationContextCommand] :: MigrationContext -> MigrationCommand -- | Verbosity of the library. [migrationContextVerbose] :: MigrationContext -> Bool -- | The PostgreSQL connection to use for migrations. [migrationContextConnection] :: MigrationContext -> Connection -- | MigrationCommand determines the action of the -- runMigration script. data MigrationCommand -- | Initializes the database with a helper table containing meta -- information. MigrationInitialization :: MigrationCommand -- | Executes migrations based on SQL scripts in the provided -- FilePath in alphabetical order. MigrationDirectory :: FilePath -> MigrationCommand -- | Executes a migration based on script located at the provided -- FilePath. MigrationFile :: ScriptName -> FilePath -> MigrationCommand -- | Executes a migration based on the provided bytestring. MigrationScript :: ScriptName -> ByteString -> MigrationCommand -- | Validates that the provided MigrationCommand has been executed. MigrationValidation :: MigrationCommand -> MigrationCommand -- | Performs a series of MigrationCommands in sequence. MigrationCommands :: [MigrationCommand] -> MigrationCommand -- | A sum-type denoting the result of a migration. data MigrationResult a -- | There was an error in script migration. MigrationError :: a -> MigrationResult a -- | All scripts have been executed successfully. MigrationSuccess :: MigrationResult a -- | The name of a script. Typically the filename or a custom name when -- using Haskell migrations. type ScriptName = String -- | The checksum type of a migration script. type Checksum = ByteString -- | Produces a list of all executed SchemaMigrations. getMigrations :: Connection -> IO [SchemaMigration] -- | A product type representing a single, executed SchemaMigration. data SchemaMigration SchemaMigration :: ByteString -> Checksum -> LocalTime -> SchemaMigration -- | The name of the executed migration. [schemaMigrationName] :: SchemaMigration -> ByteString -- | The calculated MD5 checksum of the executed script. [schemaMigrationChecksum] :: SchemaMigration -> Checksum -- | A timestamp without timezone of the date of execution of the script. [schemaMigrationExecutedAt] :: SchemaMigration -> LocalTime instance GHC.Read.Read Database.PostgreSQL.Simple.Migration.SchemaMigration instance GHC.Classes.Eq Database.PostgreSQL.Simple.Migration.SchemaMigration instance GHC.Show.Show Database.PostgreSQL.Simple.Migration.SchemaMigration instance Data.Traversable.Traversable Database.PostgreSQL.Simple.Migration.MigrationResult instance Data.Foldable.Foldable Database.PostgreSQL.Simple.Migration.MigrationResult instance GHC.Base.Functor Database.PostgreSQL.Simple.Migration.MigrationResult instance GHC.Classes.Ord a => GHC.Classes.Ord (Database.PostgreSQL.Simple.Migration.MigrationResult a) instance GHC.Read.Read a => GHC.Read.Read (Database.PostgreSQL.Simple.Migration.MigrationResult a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Database.PostgreSQL.Simple.Migration.MigrationResult a) instance GHC.Show.Show a => GHC.Show.Show (Database.PostgreSQL.Simple.Migration.MigrationResult a) instance GHC.Classes.Ord Database.PostgreSQL.Simple.Migration.CheckScriptResult instance GHC.Read.Read Database.PostgreSQL.Simple.Migration.CheckScriptResult instance GHC.Classes.Eq Database.PostgreSQL.Simple.Migration.CheckScriptResult instance GHC.Show.Show Database.PostgreSQL.Simple.Migration.CheckScriptResult instance GHC.Classes.Ord Database.PostgreSQL.Simple.Migration.MigrationCommand instance GHC.Read.Read Database.PostgreSQL.Simple.Migration.MigrationCommand instance GHC.Classes.Eq Database.PostgreSQL.Simple.Migration.MigrationCommand instance GHC.Show.Show Database.PostgreSQL.Simple.Migration.MigrationCommand instance GHC.Classes.Ord Database.PostgreSQL.Simple.Migration.SchemaMigration instance Database.PostgreSQL.Simple.FromRow.FromRow Database.PostgreSQL.Simple.Migration.SchemaMigration instance Database.PostgreSQL.Simple.ToRow.ToRow Database.PostgreSQL.Simple.Migration.SchemaMigration instance GHC.Base.Semigroup Database.PostgreSQL.Simple.Migration.MigrationCommand instance GHC.Base.Monoid Database.PostgreSQL.Simple.Migration.MigrationCommand