postgresql-migration-0.2.1.1: PostgreSQL Schema Migrations
Copyright(c) 2014 Andreas Meingast <ameingast@gmail.com>
LicenseBSD-style
Maintainerandre@andrevdm.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Simple.Migration.V1Compat

Description

A migration library for postgresql-simple.

For usage, see Readme.markdown.

Synopsis

Migration actions

runMigrations Source #

Arguments

:: Bool

Run in verbose mode

-> Connection

The postgres connection to use

-> [MigrationCommand]

The commands to run

-> IO (MigrationResult String) 

sequenceMigrations :: Monad m => [m (MigrationResult e)] -> m (MigrationResult e) Source #

Run a sequence of contexts, stopping on the first failure

Migration types

data MigrationContext Source #

The MigrationContext provides an execution context for migrations.

Constructors

MigrationContext 

Fields

data MigrationCommand Source #

MigrationCommand determines the action of the runMigration script.

Constructors

MigrationInitialization

Initializes the database with a helper table containing meta information.

MigrationDirectory FilePath

Executes migrations based on SQL scripts in the provided FilePath in alphabetical order.

MigrationFile ScriptName FilePath

Executes a migration based on script located at the provided FilePath.

MigrationScript ScriptName ByteString

Executes a migration based on the provided bytestring.

MigrationValidation MigrationCommand

Validates that the provided MigrationCommand has been executed.

MigrationCommands [MigrationCommand]

Performs a series of MigrationCommands in sequence.

Instances

Instances details
Eq MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Ord MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Read MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Show MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Semigroup MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Monoid MigrationCommand Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

data MigrationResult a Source #

A sum-type denoting the result of a migration.

Constructors

MigrationError a

There was an error in script migration.

MigrationSuccess

All scripts have been executed successfully.

Instances

Instances details
Functor MigrationResult Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Methods

fmap :: (a -> b) -> MigrationResult a -> MigrationResult b #

(<$) :: a -> MigrationResult b -> MigrationResult a #

Foldable MigrationResult Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Methods

fold :: Monoid m => MigrationResult m -> m #

foldMap :: Monoid m => (a -> m) -> MigrationResult a -> m #

foldMap' :: Monoid m => (a -> m) -> MigrationResult a -> m #

foldr :: (a -> b -> b) -> b -> MigrationResult a -> b #

foldr' :: (a -> b -> b) -> b -> MigrationResult a -> b #

foldl :: (b -> a -> b) -> b -> MigrationResult a -> b #

foldl' :: (b -> a -> b) -> b -> MigrationResult a -> b #

foldr1 :: (a -> a -> a) -> MigrationResult a -> a #

foldl1 :: (a -> a -> a) -> MigrationResult a -> a #

toList :: MigrationResult a -> [a] #

null :: MigrationResult a -> Bool #

length :: MigrationResult a -> Int #

elem :: Eq a => a -> MigrationResult a -> Bool #

maximum :: Ord a => MigrationResult a -> a #

minimum :: Ord a => MigrationResult a -> a #

sum :: Num a => MigrationResult a -> a #

product :: Num a => MigrationResult a -> a #

Traversable MigrationResult Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Methods

traverse :: Applicative f => (a -> f b) -> MigrationResult a -> f (MigrationResult b) #

sequenceA :: Applicative f => MigrationResult (f a) -> f (MigrationResult a) #

mapM :: Monad m => (a -> m b) -> MigrationResult a -> m (MigrationResult b) #

sequence :: Monad m => MigrationResult (m a) -> m (MigrationResult a) #

Eq a => Eq (MigrationResult a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Ord a => Ord (MigrationResult a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Read a => Read (MigrationResult a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

Show a => Show (MigrationResult a) Source # 
Instance details

Defined in Database.PostgreSQL.Simple.Migration

type ScriptName = String Source #

The name of a script. Typically the filename or a custom name when using Haskell migrations.

type Checksum = ByteString Source #

The checksum type of a migration script.

Migration result actions

getMigrations :: Connection -> IO [SchemaMigration] Source #

Produces a list of all executed SchemaMigrations in the default schema_migrations table

Migration result types

data SchemaMigration Source #

A product type representing a single, executed SchemaMigration.

Constructors

SchemaMigration 

Fields