Safe Haskell | None |
---|
This helper module is intended for use by the backend creators
- data Column = Column {}
- data UniqueDef' = UniqueDef' String UniqueType [String]
- type Reference = (String, [(String, String)])
- data TableInfo = TableInfo {
- tablePrimaryKeyName :: Maybe String
- tableColumns :: [Column]
- tableUniques :: [UniqueDef']
- tableReferences :: [(Maybe String, Reference)]
- data AlterColumn
- type AlterColumn' = (String, AlterColumn)
- data AlterTable
- data AlterDB
- data MigrationPack m = MigrationPack {
- compareTypes :: DbType -> DbType -> Bool
- compareRefs :: (Maybe String, Reference) -> (Maybe String, Reference) -> Bool
- compareUniqs :: UniqueDef' -> UniqueDef' -> Bool
- checkTable :: String -> m (Maybe (Either [String] TableInfo))
- migTriggerOnDelete :: String -> [(String, String)] -> m (Bool, [AlterDB])
- migTriggerOnUpdate :: String -> String -> String -> m (Bool, [AlterDB])
- migConstr :: MigrationPack m -> Bool -> String -> ConstructorDef -> m (Bool, SingleMigration)
- escape :: String -> String
- primaryKeyType :: String
- foreignKeyType :: String
- mainTableId :: String
- defaultPriority :: Int
- addUniquesReferences :: [UniqueDef'] -> [Reference] -> ([String], [AlterTable])
- showColumn :: Column -> String
- showAlterDb :: AlterDB -> SingleMigration
- mkColumns :: (DbType -> DbType) -> String -> DbType -> ([Column], [Reference])
- migrateRecursively :: (Monad m, PersistEntity v) => (EntityDef -> m SingleMigration) -> (DbType -> m SingleMigration) -> v -> StateT NamedMigrations m ()
- migrateEntity :: Monad m => MigrationPack m -> EntityDef -> m SingleMigration
- migrateList :: Monad m => MigrationPack m -> DbType -> m SingleMigration
- getAlters :: MigrationPack m -> TableInfo -> TableInfo -> [AlterTable]
- defaultMigConstr :: Monad m => MigrationPack m -> Bool -> String -> ConstructorDef -> m (Bool, SingleMigration)
Documentation
type Reference = (String, [(String, String)])Source
Foreign table name and names of the corresponding columns
TableInfo | |
|
data AlterColumn Source
type AlterColumn' = (String, AlterColumn)Source
data AlterTable Source
AddTable String | |
AlterTable String String TableInfo TableInfo [AlterTable] | Table name, create statement, structure of table from DB, structure of table from datatype, alters |
DropTrigger String String | Trigger name, table name |
AddTriggerOnDelete String String String | Trigger name, table name, body |
AddTriggerOnUpdate String String String String | Trigger name, table name, field name, body |
CreateOrReplaceFunction String | |
DropFunction String |
data MigrationPack m Source
MigrationPack | |
|
:: (Monad m, PersistEntity v) | |
=> (EntityDef -> m SingleMigration) | migrate entity |
-> (DbType -> m SingleMigration) | migrate list |
-> v | initial entity |
-> StateT NamedMigrations m () |
Create migration for a given entity and all entities it depends on. The stateful Map is used to avoid duplicate migrations when an entity type occurs several times in a datatype
migrateEntity :: Monad m => MigrationPack m -> EntityDef -> m SingleMigrationSource
migrateList :: Monad m => MigrationPack m -> DbType -> m SingleMigrationSource
getAlters :: MigrationPack m -> TableInfo -> TableInfo -> [AlterTable]Source
defaultMigConstr :: Monad m => MigrationPack m -> Bool -> String -> ConstructorDef -> m (Bool, SingleMigration)Source