migrant-core-0.1.0.2: Semi-automatic database schema migrations
Safe HaskellNone
LanguageHaskell2010

Database.Migrant.Driver.Class

Synopsis

Documentation

class Driver d where Source #

A migrations driver abstracts over the database to run over and the associated migration mechanism.

Methods

withTransaction :: (d -> IO a) -> d -> IO a Source #

initMigrations :: d -> IO () Source #

Initialize the migrations system on the backend. This should generally involve creating a table of ordered migration names, e.g.: @@ CREATE TABLE IF NOT EXISTS _migrations (id SERIAL PRIMARY KEY, name TEXT); @@

  • *Note** that initMigrations should be idempotent, that is, executing it when the migrations system has already been initialized should be a no-op.

markUp :: MigrationName -> d -> IO () Source #

Mark a migration as "executed". Typically, this will INSERT a row into the migrations table.

markDown :: MigrationName -> d -> IO () Source #

Mark a migration as "not executed" / "rolled back". Typically, this will DELETE a row from the migrations table.

getMigrations :: d -> IO [MigrationName] Source #

Get the list of migrations applied to the backend, in the order they were applied.