| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PostgreSQL.Migration.Persistent
Contents
Description
uses Postgres migration to run all found migrations in a transaction. then use persistent to check if the persistent model aligns with what's in the database.
Synopsis
- runMigrations :: PersistentMigrationOptions -> Migration -> Pool SqlBackend -> IO PMMigrationResult
- data PMMigrationResult
- defaultOptions :: FilePath -> (Either Text Text -> IO ()) -> PersistentMigrationOptions
- data PersistentMigrationOptions = PersistentMigrationOptions {}
Documentation
Arguments
| :: PersistentMigrationOptions | |
| -> Migration | the Automatic migration. eg |
| -> Pool SqlBackend | sql pool, created with for example |
| -> IO PMMigrationResult |
Run the given migrations in a single transaction. If the migration fails somehow the transaction is rolled back.
data PMMigrationResult Source #
The result of the postgresql-migration operation.
Constructors
| MigrationConsistent | |
| MigrationRollbackDueTo [Text] | rollback due to persistent inconsistencies |
| MigrationLibraryError String | some error from the postgres migration libraries |
| MigrationNotBackedByPg | caused by |
Instances
| Show PMMigrationResult Source # | |
Defined in PostgreSQL.Migration.Persistent Methods showsPrec :: Int -> PMMigrationResult -> ShowS # show :: PMMigrationResult -> String # showList :: [PMMigrationResult] -> ShowS # | |
| Eq PMMigrationResult Source # | |
Defined in PostgreSQL.Migration.Persistent Methods (==) :: PMMigrationResult -> PMMigrationResult -> Bool # (/=) :: PMMigrationResult -> PMMigrationResult -> Bool # | |
options
Arguments
| :: FilePath | migrations folder, for exmaple "migrations/up" |
| -> (Either Text Text -> IO ()) | the logging options, for example (case
Left errmsg -> runInIO $ $logTM AlertS $ logStr errmsg
Right infoMsg -> runInIO $ $logTM InfoS $ logStr infoMsg)
|
| -> PersistentMigrationOptions |
recommended default options for production settnigs