Maintainer | Brandon Chinn <brandonchinn178@gmail.com> |
---|---|
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Defines the Operation data types.
Synopsis
- type Version = Int
- type OperationPath = (Version, Version)
- (~>) :: Version -> Version -> OperationPath
- type Migration = [MigrationPath]
- data MigrationPath = OperationPath := [Operation]
- opPath :: MigrationPath -> OperationPath
- data Operation
- = CreateTable {
- name :: Text
- schema :: [Column]
- constraints :: [TableConstraint]
- | DropTable { }
- | RenameTable { }
- | AddConstraint { }
- | DropConstraint {
- table :: Text
- constraintName :: Text
- | AddColumn {
- table :: Text
- column :: Column
- colDefault :: Maybe PersistValue
- | RenameColumn { }
- | DropColumn { }
- | RawOperation {
- message :: Text
- rawOp :: SqlPersistT IO [MigrateSql]
- = CreateTable {
- validateOperation :: Operation -> Either String ()
Documentation
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.
Instances
Show MigrationPath Source # | |
Defined in Database.Persist.Migration.Operation showsPrec :: Int -> MigrationPath -> ShowS # show :: MigrationPath -> String # showList :: [MigrationPath] -> ShowS # |
opPath :: MigrationPath -> OperationPath Source #
Get the OperationPath in the MigrationPath.
An operation that can be migrated.
CreateTable | |
| |
DropTable | |
RenameTable | |
AddConstraint | |
| |
DropConstraint | |
| |
AddColumn | |
| |
RenameColumn | |
DropColumn | |
RawOperation | A custom operation that can be defined manually. RawOperations should primarily use asks connRDBMS >>= case "sqlite" -> ... _ -> return () |
|
validateOperation :: Operation -> Either String () Source #
Validate that the given Operation is valid.
Orphan instances
Show (SqlPersistT m a) Source # | |
showsPrec :: Int -> SqlPersistT m a -> ShowS # show :: SqlPersistT m a -> String # showList :: [SqlPersistT m a] -> ShowS # |