module Database.Persist.Migration
(
Version
, OperationPath
, (~>)
, Operation(..)
, Migration
, MigrateBackend(..)
, Migrateable(..)
, MigrateSettings(..)
, defaultSettings
, hasMigration
, checkMigration
, CreateTable(..)
, DropTable(..)
, AddColumn(..)
, DropColumn(..)
, RawOperation(..)
, NoOp(..)
, ColumnIdentifier
, dotted
, Column(..)
, ColumnProp(..)
, TableConstraint(..)
) where
import Control.Monad (unless)
import qualified Data.Text as Text
import Database.Persist.Migration.Internal
import qualified Database.Persist.Sql as Persistent
hasMigration :: Persistent.Migration -> Persistent.SqlPersistT IO Bool
hasMigration = fmap (not . null) . Persistent.showMigration
checkMigration :: Persistent.Migration -> Persistent.SqlPersistT IO ()
checkMigration migration = do
migrationText <- Persistent.showMigration migration
unless (null migrationText) $ fail $
unlines $ "More migrations detected:" : bullets migrationText
where
bullets = map ((" * " ++ ) . Text.unpack)