Modulepostgresql-migration-0.2.1.8Haskell2010
Database.PostgreSQL.Simple.Migration
A migration library for postgresql-simple.
For usage, see Readme.markdown.
- 8 types
- 6 values
- Packagepostgresql-migration-0.2.1.8
- Exports14
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceMigration.hs
Migration actions
4 declarationsExecutes migrations using the provided MigrationOptions.
Returns MigrationSuccess if the provided MigrationCommand executes without error. If an error occurs, execution is stopped and a MigrationError is returned.
runMigrations :: ConnectionThe postgres connection to use
-> MigrationOptionsThe options for this migration
-> [MigrationCommand]The commands to run
-> 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.
Run a sequence of contexts, stopping on the first failure
Migration types
7 declarationsThe checksum type of a migration script.
Constructors
MigrationOptionsoptVerbose :: !VerbosityVerbosity of the library.
optTableName :: !ByteStringThe name of the table that stores the migrations, usually "schema_migrations"
optLogWriter :: !Either Text Text -> IO ()optTransactionControl :: !TransactionControlIf/when transactions should be started
MigrationCommand determines the action of the runMigration script.
Constructors
MigrationInitializationInitializes the database with a helper table containing meta information.
MigrationDirectory FilePathExecutes migrations based on SQL scripts in the provided FilePath in alphabetical order.
MigrationFile ScriptName FilePathExecutes a migration based on script located at the provided FilePath.
MigrationScript ScriptName ByteStringExecutes a migration based on the provided bytestring.
MigrationValidation MigrationCommandValidates that the provided MigrationCommand has been executed.
MigrationCommands [MigrationCommand]Performs a series of MigrationCommands in sequence.
Instances6Eq, Ord, Read, Show, Semigroup, Monoid
Eq MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationOrd MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationRead MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationShow MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationSemigroup MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationMonoid MigrationCommandDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.Migration
A sum-type denoting the result of a migration.
Constructors
MigrationError aThere was an error in script migration.
MigrationSuccessAll scripts have been executed successfully.
Instances7Functor, Foldable, Traversable, Eq, Ord, Read, …
Functor MigrationResultDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationFoldable MigrationResultDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationTraversable MigrationResultDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationEq a => Eq (MigrationResult a)Defined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationOrd a => Ord (MigrationResult a)Defined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationRead a => Read (MigrationResult a)Defined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationShow a => Show (MigrationResult a)Defined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.Migration
The name of a script. Typically the filename or a custom name when using Haskell migrations.
Determines how transactions are handled. It is recommened to use transaction when running migrations. Certain actions require a transaction per script, if you are doing this use TransactionPerStep. If you want a single transaction for all migrations use TransactionPerRun. If you do not want a transaction, or are using an existing transaction then use NoNewTransaction.
Constructors
NoNewTransactionNo new transaction will be started. Up to the caller to decide if the run is in a transaction or not
TransactionPerRunCall withTransaction once for the entire MigrationCommand
TransactionPerStepCall withTransaction once for each step in a MigrationCommand (i.e. new transaction per script)
Instances1Show
Show TransactionControlDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.Migration
Migration result actions
2 declarationsProduces a list of all executed SchemaMigrations in the default schema_migrations table
Produces a list of all executed SchemaMigrations.
Migration result types
1 declarationA product type representing a single, executed SchemaMigration.
Constructors
SchemaMigrationschemaMigrationName :: ByteStringThe name of the executed migration.
schemaMigrationChecksum :: ChecksumThe calculated MD5 checksum of the executed script.
schemaMigrationExecutedAt :: LocalTimeA timestamp without timezone of the date of execution of the script.
Instances6Eq, Ord, Read, Show, FromRow, ToRow
Eq SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationOrd SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationRead SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationShow SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationFromRow SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.MigrationToRow SchemaMigrationDefined in postgresql-migration-0.2.1.8 · Database.PostgreSQL.Simple.Migration