Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Database.Migrant.Driver.Class
Synopsis
- class Driver d where
- withTransaction :: (d -> IO a) -> d -> IO a
- initMigrations :: d -> IO ()
- markUp :: MigrationName -> d -> IO ()
- markDown :: MigrationName -> d -> IO ()
- getMigrations :: d -> IO [MigrationName]
- data DummyDriver = DummyDriver
Documentation
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.
Instances
Driver DummyDriver Source # | |
Defined in Database.Migrant.Driver.Class Methods withTransaction :: (DummyDriver -> IO a) -> DummyDriver -> IO a Source # initMigrations :: DummyDriver -> IO () Source # markUp :: MigrationName -> DummyDriver -> IO () Source # markDown :: MigrationName -> DummyDriver -> IO () Source # getMigrations :: DummyDriver -> IO [MigrationName] Source # |
data DummyDriver Source #
Constructors
DummyDriver |
Instances
Driver DummyDriver Source # | |
Defined in Database.Migrant.Driver.Class Methods withTransaction :: (DummyDriver -> IO a) -> DummyDriver -> IO a Source # initMigrations :: DummyDriver -> IO () Source # markUp :: MigrationName -> DummyDriver -> IO () Source # markDown :: MigrationName -> DummyDriver -> IO () Source # getMigrations :: DummyDriver -> IO [MigrationName] Source # |