persistent-migration-0.3.0: Manual migrations for the persistent library
MaintainerBrandon Chinn <brandonchinn178@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Database.Persist.Migration.Core

Description

Defines a migration framework for the persistent library.

Synopsis

Documentation

type Version = Int Source #

The version of a database. An operation migrates from the given version to another version.

The version must be increasing, such that the lowest version is the first version and the highest version is the most up-to-date version.

A version represents a version of the database schema. In other words, any set of operations taken to get to version X *MUST* all result in the same database schema.

type OperationPath = (Version, Version) Source #

The path that an operation takes.

(~>) :: Version -> Version -> OperationPath Source #

An infix constructor for OperationPath.

type Migration = [MigrationPath] Source #

A migration list that defines operations to manually migrate a database schema.

data MigrationPath Source #

A path representing the operations needed to run to get from one version of the database schema to the next.

Constructors

OperationPath := [Operation] 

Instances

Instances details
Show MigrationPath Source # 
Instance details

Defined in Database.Persist.Migration.Core

opPath :: MigrationPath -> OperationPath Source #

Get the OperationPath in the MigrationPath.

newtype MigrateSettings Source #

Settings to customize migration steps.

Constructors

MigrateSettings 

Fields

defaultSettings :: MigrateSettings Source #

Default migration settings.

validateMigration :: Migration -> Either String () Source #

Validate the given migration.

runMigration :: MonadIO m => MigrateBackend -> MigrateSettings -> Migration -> SqlPersistT m () Source #

Run the given migration. After successful completion, saves the migration to the database.

getMigration :: MonadIO m => MigrateBackend -> MigrateSettings -> Migration -> SqlPersistT m [MigrateSql] Source #

Get the SQL queries for the given migration.