beam-migrate-0.2.0.0: SQL DDL support and migrations support library for Beam

Safe HaskellNone
LanguageHaskell2010

Database.Beam.Migrate.Simple

Description

Utility functions for common use cases

Synopsis

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.

BeamMigrationBackends 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.