refurb-0.2.2.0: Tools for maintaining a database

Safe HaskellNone
LanguageHaskell2010

Refurb.Types

Description

Module containing externally useful types for Refurb, most notably the Migration type.

Synopsis

Documentation

data ConnInfo Source #

Structure with connection information for connecting to the database.

Constructors

ConnInfo 

Fields

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.

Constructors

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.

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 Migration Source #

Data type of a migration, with its key, type, and actions.

Constructors

Migration 

Fields

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.

withCheck :: Migration -> (forall m. MonadMigration m => m ()) -> Migration Source #

Attach a check function to a Migration.