Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions for common use cases
- simpleSchema :: Database db => ActionProvider cmd -> CheckedDatabaseSettings be db -> Maybe [cmd]
- simpleMigration :: (MonadBeam cmd be handle m, Database db) => BeamMigrationBackend be cmd handle -> handle -> CheckedDatabaseSettings be db -> IO (Maybe [cmd])
- runSimpleMigration :: MonadBeam cmd be hdl m => hdl -> [cmd] -> IO ()
- backendMigrationScript :: (cmd -> String) -> Migration cmd a -> String
- module Database.Beam.Migrate.Actions
- module Database.Beam.Migrate.Types
Documentation
simpleSchema :: Database db => ActionProvider cmd -> CheckedDatabaseSettings be db -> Maybe [cmd] Source #
Attempt to find a SQL schema given an ActionProvider
and a checked
database. Returns Nothing
if no schema could be found, which usually means
you have chosen the wrong ActionProvider
, or the backend you're using is
buggy.
simpleMigration :: (MonadBeam cmd be handle m, Database db) => BeamMigrationBackend be cmd handle -> handle -> CheckedDatabaseSettings be db -> IO (Maybe [cmd]) Source #
Given a migration backend, a handle to a database, and a checked database,
attempt to find a schema. This should always return Just
, unless the
backend has incomplete migrations support.
BeamMigrationBackend
s can usually be found in a module named
Database.Beam.Backend.Migrate
with the namemigrationBackend
runSimpleMigration :: MonadBeam cmd be hdl m => hdl -> [cmd] -> IO () Source #
Run a sequence of commands on a database
backendMigrationScript :: (cmd -> String) -> Migration cmd a -> String Source #
Given a function to convert a command to a String
, produce a script that
will execute the given migration. Usually, the function you provide
eventually calls displaySyntax
to rendere the command.
module Database.Beam.Migrate.Types