Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.PostgreSQL.PQTypes.Model.Migration
Description
Using migrations is fairly easy. After you've defined the lists of
migrations and tables, just run
migrateDatabase
:
tables :: [Table] tables = ... migrations :: [Migration] migrations = ... migrateDatabase options extensions domains tables migrations
Migrations are run strictly in the order specified in the migrations
list, starting with the first migration for which the corresponding
table in the DB has the version number equal to the mgrFrom
field of
the migration.
- data DropTableMode
- data MigrationAction m
- = StandardMigration (m ())
- | DropTableMigration DropTableMode
- data Migration m = Migration {
- mgrTableName :: RawSQL ()
- mgrFrom :: Int32
- mgrAction :: MigrationAction m
- isStandardMigration :: Migration m -> Bool
- isDropTableMigration :: Migration m -> Bool
Documentation
data DropTableMode Source #
Whether to also drop objects that depend on the table.
Constructors
DropTableCascade | Automatically drop objects that depend on the table (such as views). |
DropTableRestrict | Refuse to drop the table if any objects depend on it. This is the default. |
data MigrationAction m Source #
Migration action to run, either an arbitrary MonadDB
action, or
something more fine-grained.
Constructors
StandardMigration (m ()) | Standard migration, i.e. an arbitrary |
DropTableMigration DropTableMode | Drop table migration. Parameter is the drop table mode
( |
Migration object.
Constructors
Migration | |
Fields
|
isStandardMigration :: Migration m -> Bool Source #
isDropTableMigration :: Migration m -> Bool Source #