Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Module containing externally useful types for Refurb, most notably the Migration
type.
Synopsis
- data ConnInfo = ConnInfo {
- connHost :: Text
- connPort :: Word16
- connUser :: Text
- connPassword :: Text
- connDbName :: Text
- connInfoAsConnString :: ConnInfo -> ByteString
- connInfoAsLogString :: ConnInfo -> Text
- data MigrationType
- type MonadMigration m = (MonadBaseControl IO m, MonadMask m, MonadReader Connection m, MonadLogger m)
- data Migration = Migration {
- _migrationSchema :: Text
- _migrationKey :: Text
- _migrationType :: MigrationType
- _migrationCheck :: forall m. MonadMigration m => Maybe (m ())
- _migrationExecute :: forall m. MonadMigration m => m ()
- migrationSchema :: Lens' Migration Text
- migrationKey :: Lens' Migration Text
- migrationType :: Lens' Migration MigrationType
- migrationCheck :: forall m. MonadMigration m => Getter Migration (Maybe (m ()))
- migrationExecute :: forall m. MonadMigration m => Getter Migration (m ())
- migrationQualifiedKey :: Migration -> Text
- schemaMigration :: Text -> Text -> (forall m. MonadMigration m => m ()) -> Migration
- seedDataMigration :: Text -> Text -> (forall m. MonadMigration m => m ()) -> Migration
- withCheck :: Migration -> (forall m. MonadMigration m => m ()) -> Migration
Documentation
Structure with connection information for connecting to the database.
ConnInfo | |
|
connInfoAsConnString :: ConnInfo -> ByteString Source #
Given a ConnInfo
make up the real connection string to pass when connecting to the database. Includes password, so never log this.
connInfoAsLogString :: ConnInfo -> Text Source #
Given a ConnInfo
make up the log-safe connection string to show to humans, which omits the password.
data MigrationType Source #
Enumeration of the types of migration that are known about.
MigrationSchema | Migration that updates the schema of the database and should be run everywhere. |
MigrationSeedData | Migration that installs or replaces data for testing purposes and should never be run in production. |
Instances
Show MigrationType Source # | |
Defined in Refurb.Types showsPrec :: Int -> MigrationType -> ShowS # show :: MigrationType -> String # showList :: [MigrationType] -> ShowS # | |
Eq MigrationType Source # | |
Defined in Refurb.Types (==) :: MigrationType -> MigrationType -> Bool # (/=) :: MigrationType -> MigrationType -> Bool # |
type MonadMigration m = (MonadBaseControl IO m, MonadMask m, MonadReader Connection m, MonadLogger m) Source #
Constraint for actions run in the context of a migration, with access to underlying IO, PostgreSQL connection, and logging.
Data type of a migration, with its key, type, and actions.
Migration | |
|
migrationCheck :: forall m. MonadMigration m => Getter Migration (Maybe (m ())) Source #
migrationExecute :: forall m. MonadMigration m => Getter Migration (m ()) Source #
migrationQualifiedKey :: Migration -> Text Source #
The fully qualified key of the migration, schema.key
schemaMigration :: Text -> Text -> (forall m. MonadMigration m => m ()) -> Migration Source #
Helper to construct a MigrationSchema
type Migration
with the given execution action and no check action.
seedDataMigration :: Text -> Text -> (forall m. MonadMigration m => m ()) -> Migration Source #
Helper to construct a MigrationSeedData
type Migration
with the given execution action and no check action.